Ruddra.com

Using IntellijIdea/Pycharm Within An Exisiting Virtualenv

Using IntellijIdea/Pycharm Within An Exisiting Virtualenv

To add a virtual environment to Intellij IDEA, You have added Python from virtualenv folder to project SDK. Which means that virtualenv directory’s python( for example venv/bin/python2.7) needs to be added to Intellij IDEA project path.

For PyCharm >= 2018

As per documentation from Pycharm:

  1. In the Project Interpreter page, click the cog icon and select Add.

  2. In the left-hand pane of the Add Python Interpreter dialog box, select Virtualenv Environment. The following actions depend on whether the virtual environment existed before.

  3. If Existing environment is selected:

    1. Specify the required interpreter: use the drop-down list, or click Select an interpreter and find one in your file system.
    2. Select the check-box Make available to all projects, if needed.
  4. Click OK to complete the task.


For Pycharm 2016 and later

To add an existing virtual environment to the list of available interpreters

In the Project Interpreter page,

page

In the drop-down list, choose to Add local. add environment option

In the Select Python Interpreter dialog box that opens, choose the desired Python executable, located inside the virtual environment folder, and click OK. Go to this link for more information. Now need to run the project.


For older versions

The virtualenv directory’s python( for example venv/bin/python2.7) needs to be added to Intellij IDEA project path. Example: need to go to file>project structure (Intellij IDEA)

1

press (new) in Project SDK, and add new path to virtualenv’s python directory like this:

2

Go to Modules>Dependencies and set your module SDK to Python SDK which is marked on this picture:

3

Click on Django (option marked in next the image) and set Django project root, Settings, Manage Script like this:

4

Now press ok and final look of the Project settings:

5

Now need to run the project.

My Stack Overflow Answer is here.

Last updated: Apr 05, 2024


← Previous
Implementation of Forgot/Reset Password Feature in Django

A DYI reset/forgot password implementation based on Django's source code in Django.

Next →
Sample Ajax GET/POST Request in Django

Let us make a test scenario here: A dropdown field which on change we are going to send a Get/Post …

Share Your Thoughts
M↓ Markdown