PyCharm Edu 2018.1 Help

Configuring Python Interpreter

Introduction

In PyCharm Edu you are not limited to using just any single Python interpreter. You are able to implement several and in doing so choose which interpreter you wish to use for any specific project.

PyCharm Edu supports:

Python interpreters can be configured on the following levels:

  • Current project: selected Python interpreter will be used for the current project.
  • New project: selected Python interpreter will be used for the new project instead of the default one.

Configuring Python virtual environment

PyCharm Edu makes it possible to create a virtual environment using the virtualenv tool. PyCharm Edu integrates with virtualenv, and enables configuring virtual environments in the IDE.

virtualenv tool comes bundled with PyCharm Edu, so the user doesn't need to install it.

To configure Python virtual environment, follow these steps:

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), click Project Interpreter.
  2. Click cogwheel framed and choose Add ....
    py interpreter types

    The Add Python Interpreter dialog box opens.

  3. In the left-hand pane of this dialog, click the Virtual Environment node. The following actions depend on whether the virtual environment existed before.

    If New virtual environment is selected:

    1. Specify the location of the new virtual environment in the text field, or click browseButton and find location in your file system. Note that the directory where the new virtual environment should be located, must be empty! The default path is derived from the WORKON_HOME environment variable. If the variable is not specified, the venv directory is created in the project root directory.
    2. Choose the base interpreter from the drop-down list, or click browseButton and find the base interpreter in the your file system.
    3. Select the Inherit global site-packages check-box if you want to inherit your global site-packages directory. This check-box corresponds to the --system-site-packages option of the virtualenv tool.
    4. Select the Make available to all projects check-box, if needed.

    If the existing virtual environment is selected:

    1. Specify the required interpreter Use the drop-down list, or click browseButton and find one in your file system.
    2. Select the check-box Make available to all projects, if needed.
  4. Click OK to apply changes and close the dialog box.

    The virtual environment is created and added to the list of available interpreters.

Configuring a local interpreter

To configure a local Python interpreter

  1. In the Project Interpreter page, click cogwheel framed.
  2. In the drop-down list, choose Add....
    py interpreter types

    The Add Python Interpreter dialog box opens.

  3. In the left-hand pane of this dialog, click System Interpreter.
  4. In the Interpreter field, type the fully-qualified path to the required interpreter executable, or click browseButton and in the Select Python Interpreter dialog box that opens, choose the desired Python executable and click OK. Note that you will need admin privileges to install, remove, and upgrade packages for the system interpreter. When attempting to install an interpreter package through an intention action, you might receive the following error message:
    System Interpreter warning message
    As prompted, consider using a virtual environment for your project.

Configuring a Conda environment

Make sure that Anaconda or Miniconda is downloaded and installed on your computer.

Whether you install Anaconda or Miniconda, depends on you needs.

To configure Conda environment, follow these steps:

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), click Project Interpreter.
  2. Click cogwheel framed and choose Add ....
    py interpreter types

    The Add Python Interpreter dialog box opens:

  3. In the left-hand pane of this dialog, click the Conda Environment node. The following actions depend on whether the Conda environment existed before.

    If New environment is selected:

    1. Specify the location of the new Conda environment in the text field, or click browseButton and find location in your file system. Note that the directory where the new Conda environment should be located, must be empty!
    2. Choose the Python version from the drop-down list.
    3. Specify the location of the Conda executable file in the text field, or click browseButton and find location in the Conda installation directory.
    4. Select the Make available to all projects check-box, if needed.

    If an existing environment is selected:

    1. Specify the required interpreter by using the drop-down list, or click browseButton and find the required Python executable in your file system.
    2. Select the check-box Make available to all projects, if needed.
  4. Click OK to apply changes and close the dialog box.

    The Conda environment is created and added to the list of available interpreters.

Viewing the list of available interpreters

The list of Python interpreters, available for the various projects, can include interpreters installed locally or remotely, and the various virtual environments and Conda environments.

To view the list of available interpreters

Python interpreter for a project

PyCharm Edu helps assign a Python interpreter for a project.

As a result, each one of the projects, opened in the same window, can have an interpreter of its own, selected from the list of available interpreters.

Note that PyCharm Edu stores only the interpreter name in the project settings.

Working on the same project on different platforms

You can work on the same PyCharm Edu project on different platforms (for example, on Windows at work, and on MacOS at home). This can be easily done, if you rename the project interpreter.

The reason is that PyCharm Edu stores the interpreter name with the project, but not the interpreter path.

To rename an interpreter, follow these steps

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), click the page Project Interpreter.
  2. Do one of the following:
    • Click gear icon next to the Project Interpreter field, and in the list of interpreter types, choose Show All....
    • Click the drop-down list in the Project Interpreter field, and choose Show All....

    The dialog box Project Interpreters opens.

  3. Choose the desired interpreter and click edit1. The dialog box Edit Python Interpreter appears.
  4. In this dialog, change the interpreter name as required.
Last modified: 23 July 2018