jeremyjjbrown
jeremyjjbrown

Reputation: 8009

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.

Upvotes: 19

Views: 20843

Answers (2)

Michael Seifert
Michael Seifert

Reputation: 992

The accepted answer works and was probably the only way to achieve opening multiple projects when the answer was authored. However, adding a new content root simply adds the files in the underlying directory to the open project. Project settings such as the Python interpreter have to be shared between content root folders.

At the time of writing, PyCharm genuinely supports multiple projects in a single window. This allows different projects to be configured differently.

The official help document contains a step-by-step guide with screenshots on how to open multiple projects in a single PyCharm window.

Upvotes: 29

Wissam Youssef
Wissam Youssef

Reputation: 830

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.

Upvotes: 14

Related Questions