Today I cloned a project from Github and needed to setup a project in PyCharm for it. These are some quick notes how to setup a new project in PyCharm based on an existing virutalenv.
- Clone the project with: git clone <URI>.
- Open PyCharm.
- Create a new project: File -> New project…
- Select project type: python
- Click create.
- Select the root directory of the virtualenv.
- Select local type by clicking the button behind the source field.
- From the Scripts directory of the virtualenv select python.exe.
- Clicke create.
- PyCharm will display a message that the directory is not empty (“The directory <…> is not empty. Would you like to create a project from the existing source instead?”).
- Click Yes.
- Select File -> Settings…
- Select Project […] -> Project Structure.
- Delete current source directory.
- Add the source directory in the virtualenv.
- Click OK.
You’re ready to rock. Have fun!