Search code examples
pythonpycharmpythonpath

How to setup PyCharm for multiple projects


I want to set up PyCharm to work on a set of Python projects in a single window.

Lets say I have this projects structure.

~/src
├── py_project1
├── py_project2
├── py_project3
├── other_lang_proj1
└── other_lang_proj2

A system PYTHONPATH of /Library/Python/2.7/site-packages:/usr/local/lib/python2.7/site-packages:/opt/proprietary/packages

and some packages at

/opt/proprietary/packages
├── project1
├── project2
└── project3

How do I add the ~/src/py_project* projects to a single PyCharm window and have them see all of the packages in PYTHONPATH and /opt/proprietary/packages/project*?

Moving directories is not optional, and I don't want virtualenv. I want to configure PyCharm once for all of the open projects. For the record the PYTHONPATH works just fine for this setup everywhere but PyCharm.


Solution

  • You can add directories to one, for example. Let's say you have ~/src/py_project1 open as a project. go to settings -> project: -> project structure then +Add Content Root, and add the directories one at a time.