如何去掉 PyCharm 中的库根标记

How to get rid of library root mark in PyCharm

我已经开始开发一个 Pyramid 应用程序,它需要 setup.py 使用,但是一旦我构建了该应用程序,我的 app 文件夹就被标记为 library root .

不方便,因为当我打开一个文件时,它也是在External Libraries下展开的。这可以通过删除 Always Select Opened File 上的检查来 "fixed",但我喜欢这个功能,所以我不想禁用它。

我也尝试在设置中调整 项目结构,但没有帮助。

如何去掉这个_library_root_标记?

更新。 setup.py的内容:

setup(
    name='app',
    version=0.1,
    description='Blog with CMS',
    classifiers=[
      "Programming Language :: Python",
      "Framework :: Pylons",
      "Topic :: Internet :: WWW/HTTP",
      "Topic :: Internet :: WWW/HTTP :: WSGI :: Application"
    ],
    keywords="web services",
    author='',
    author_email='',
    url='',
    packages=find_packages(),
    include_package_data=True,
    zip_safe=False,
    install_requires=['cornice', 'waitress'],
    entry_points="""\
    [paste.app_factory]
    main=app:main
    """,
    paster_plugins=['pyramid']
)

发生这种情况的原因是 PyCharm 在 pip install -e 后将 sd-blog/app 添加到解释器路径,以便能够为 app 对象提供完成。可能的解决方法:

  1. 从解释器路径中删除 app

  2. sd-blog/app 标记为源根以恢复在步骤 1 中损坏的代码洞察