How do I install packages in PyCharm for all projects?

前端 未结 2 350
春和景丽
春和景丽 2021-02-01 05:22

I use PyCharm and all the initial settings are okay.Simple package installation is working. Then why do I need to reinstall a package for each project? Is there any way to insta

2条回答
  •  臣服心动
    2021-02-01 05:47

    This is depending on your project settings, the project interpreter to be specific.

    The project interpreter can be set to one of the following:

    • an interpreter installed globally on your system
    • an interpreter in a shared virtual environment
    • an interpreter in a virtual environment associated with a project

    Now the approach I'd recommend would be to create a shared virtual environment where you install your packages to, and use this environment for all your project.

    That way, you have the desired result of needing to install your packages only once, but still have an environment isolated from your system environment.

    To create such an environment, follow these steps:

    1. Settings -> Project -> Project Interpreter
    2. Click the cogwheel / gear icon right-side the interpreter dropdown
    3. Select "Add Local..." -> Virtualenv Environment
    4. Select a path as a root directory for the new environment
    5. Select base interpreter you want to use
    6. Tick the checkbox "Make available to all projects"
    7. Click the "OK" button to save the new environment

提交回复
热议问题