How to add external library to Python plugin in CLion?

All my Python files are dependent on other project.

I cannot find a configuration to specify python path.  I guess I can add it to Python itself, but then I would need to create new Python installation for each CLion project, which is quite inconvenient.

 

2
2 comments
Avatar
Permanently deleted user

I managed to get this to work, finally. The trick is to set up a virtualenv and then put your changes to e.g. PYTHONPATH in the activate script. Then have CLion use the python inside the virtualenv. This made it possible to find all the local files associated with the project.

0

As an alternative:  in your virtual environment  ->lib ->site-packages  create a symbolic link to the external packages you want to access.  This works if you only have a few. 

I was unable to determine where the PYTHONPATH was set in the activate script.

 

0

Please sign in to leave a comment.