Add External Library to PyCharm 2022.1.4 (Professional Edition)

We built a series of python files that we want to share across multiple projects and stored them remotely as /ourpython/lib.


Using Settings > Python Interpreter > Wheel (symbol) > Show All > File (symbol) we added /ourpython/lib  (added by user).

How do I import that external library into pycharm so my code knows it is there and stops throwing errors that "unresolved reference".    The code works on the external server as we have export PYTHONPATH = :/ourpython/lib added.



Do you have that library on your local machine?
If not, then there is no way for PyCharm to resolve it. Although using JetBrains Gateway may be a good solution as it allows working on projects fully remotely.


The files are in a project called python-lib which is loaded on all are computers working on the project.   


Works on my dirt bag collection of modules into a library directory in 2022.2.5 Pro.

Navigate File - Settings... - Project: <your project name> - Project Structure

On the right hand side I see "+ Add Content Root". Click that.

In the pop-up "Select Content Root Directory", select the directory the library lives in. Click 'OK', 'Apply', 'OK'.

The library should show in the project pane under the main project.

There was another way I used to use where it would show under "External Libraries" (so many ways to configure things!), but this way puts the directory in that location. So far, at least PyCharmt recognizes the module I needed from my library?

Good luck,



Please sign in to leave a comment.