简体   繁体   中英

Installing libraries for every project in Pycharm

I am using latest version of Pycharm community edition for my Python IDE, when I will install all necessary libraries for one project, I need to reinstall it for other projects because I can't import those libraries.

How can I fix this one? Should I install every time? Maybe there is some command by which I can install during program's running time? I mean in shell? I think I should update somehow path, I was searching a lot in internet, but unfortunately could not find anything relevant for this issue, or maybe I can't guess solution.

To fix your issue, I suggest you should create a Virtualenv Environment and make it available for all projects:

File >> Settings

Project >> Project Interpreter >>>>> Add

在此处输入图片说明

New environment / Existing Environment >> [x]Inherit global site-packages [x] Make available to all projects >> [OK]

在此处输入图片说明

Then install your modules/libs in the Project Interpreter box with the symbol +

在此处输入图片说明

Whenever you change the project, just pick that venv in Project Interpreter and use as normal

Go to File > Settings. Then from left side go to Project > Project Interpreter. Now, from the Project Interpreter dropdown, you can select your desired environment.

You can use command line to install your packages. This will be easier to import since all packages are installed as global packages but its not recommended because it may cause conflicts between packages.

Then every time you start a new project you just inherit from global package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM