Make a PyCharm project inheriting global site-packages, after creating the project?

后端 未结 1 1460
攒了一身酷
攒了一身酷 2021-02-06 14:28

I\'m a newbie with PyCharm and Mac OS. I created a python project in PyCharm with VirtualEnv, and I didn\'t select the option of \'Inherit global site packages\'. After working

1条回答
  •  青春惊慌失措
    2021-02-06 15:31

    I figured this out when clicking around.

    1. In Pycharm, go to File -> Settings... -> Project -> Project Interpreter, click on the gear icon next to the menu:

    2. Then choose "Show all...", and select the virtual environment you want to change, click this icon to add global packages' path into this venv's path

    then click ok or apply to make it work. Usually, your global packages' path is "/path-to-python/Lib/site-packages", for my desktop is:

    Now you can use all your global packages within the venv. For any system other than Windows, this should work fine as well.

    But you won't see any global packages in pycharm's package viewer for this venv, which totally makes sense, because pycharm can only manager the venv for you, not the global one.


    For your separate question: Yes. Because you only add global path into your venv, not like copying all package files into it. After adding the global path, all global packages should work inside your venv at any time.

    0 讨论(0)
提交回复
热议问题