Adding external libraries in PyCharm Professional

2019-04-26 18:25发布

问题:

I'm trying to add external libraries to my project, but there seems no way to do so in PyCharm 4 (Professional). I found several similar questions with accepted answers, however those seem only work on older PyCharm versions.

This is one example: PyCharm and external libraries

Does anyone know how to add paths for external Python packages and modules in PyCharm 4 Professional?

回答1:

With the latest PyCharm version (2018.1) under File -> Default Settings -> Project Interpreter you can select which interpreter to use (OS default or any other distribution you may have manually installed).

The box in the middle lists all the packages currently installed, while the + button at the bottom allow to install packages from public repositories.

If you want to add custom packages you have to manually specify the path:

Select the interpreter and click on "Show paths for the selected interpreter"

Add the path of the new module



回答2:

If you want to install a pip package, the install button is still there, on the right hand side of the Project Interpreter configuration pane.

If you want to change the list of paths for an interpreter, press the "gear" button in the Project Interpreter configuration pane, then click on "More...", and then press "Show paths for the selected interpreter". In the dialog that appears, you can add or remove paths as needed.