Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 802
jeremyjjbrown Avatar asked Dec 16 '15 18:12

jeremyjjbrown


People also ask

How do I run multiple projects in PyCharm?

Open multiple projects Then, depending on the option selected in the Project Opening section of the System Settings page of the Settings/Preferences dialog ( Ctrl+Alt+S ), PyCharm can ask you for the following alternatives: If the New Window option is selected, the new project silently opens in a new window.

Can I open 2 PyCharm?

Considering the thread from their official website which can be found here, you can open multiple instances only if they use separate config/system directories (this can be configured in idea. properties inside the PyCharm installation directory). Alternatively, you can open multiple frames in one PyCharm instance.

How do I add a project to PyCharm?

Create new files In the Project tool window Alt+1 , select the directory or package in which you want to create a new file, and then choose File | New from the main menu. Right-click the corresponding directory or package and select New from the context menu. Press Alt+Insert .

How do projects work in PyCharm?

Whatever you do in PyCharm, you do that in the context of a project. A project is an organizational unit that represents a complete software solution. It serves as a basis for coding assistance, bulk refactoring, coding style consistency, and so on. Once you have opened a folder in PyCharm, the .


2 Answers

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.

like image 161
Michael Seifert Avatar answered Oct 06 '22 09:10

Michael Seifert


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.

like image 20
Wissam Youssef Avatar answered Oct 06 '22 07:10

Wissam Youssef