How to Select Python Version in Pycharm

How to select Python version in PyCharm?

File -> Settings

Preferences->Project Interpreter->Python Interpreters

If it's not listed add it.

Sample Image

How to change version of Python in PyCharm

First make sure you have Python 3.6 installed.

Then Go to File > Settings > Project:* > Project Interpreter, then select your interpreter under the Project Interpreter drop down.

If its still not there, you can also press the settings cog button Sample Image on the right side of the drop down and select add. Select System Interpreter from the left side, then select the interpreter from there. When you press ok, the interpreter will be available to be selected.

Working with second python version in pycharm

You can create a new virtual environment with conda using the following command and specify the required version. More info on conda create

conda create -n py35 python=3.5

it will install the Python3.5 on your system most likely in C:\Users\user\AppData\Local\Continuum\Anaconda3\envs You can then add that python version in Pycharm as the project interpreter using

File -> Settings --> Project --> Project Interpreter

Click on the Setttings icon in the right pane & locate the Python version on your system and then add it as the python version for this project.

Refer Pycharm documentation for more details

How to downgrade python in pycharm from 3.8 to 3.7 (I'm trying to run Tensorflow)

  1. Download and install Python 3.7
  2. In PyCharm, go to 'File' -> 'Settings' -> 'Project: <...>' -> 'Project Interpreter', and select 'Python 3.7' in the 'Project Interpreter' dropdown.
  3. If you don't see it, click on the settings icon next to it, go
    to the 'System Interpreter' tab, and browse to and select
    'python.exe' from the Python37 folder

Upgrading pycharm venv python version

You need to create a new virtual environment with the interpreter which version is 3.8.

  1. Go to Settings => Project => Python Interpreter

Sample Image


  1. Click on the vertical 3 dots, and click on "Add".

Sample Image


  1. Select Virtualenv Environment => New Environment

Sample Image


  1. Choose as base interpreter the one which version is 3.8 (the one you just installed)

Sample Image


  1. Click on "OK" => "OK"

  2. Once you have set the new interpreter, PyCharm will warn you that you need update some dependencies based on your requirements.txt file or, in this case, Pipfile.lock (I am using pipenv for this project)

Sample Image

That's it!

Wrong Python version in PyCharm's inspections

Go to Settings->Editor->Inspections. There in Python->Code compatibility inspections, you should see that Python 3.5's box is ticked in.

This allows you to choose for which versions of Python your code will be inspected.

Add Python 3.7 to Pycharm

What you have added is not the exe, it's just the shortcut (.lnk) file to the exe. So even though you renamed it, that will not work! What you can do is you can right-click and select Open file location and get the real exe pathname and add it to Pycharm.

Steps with pictures:

  1. Get the real Python exe path
    Image
    Right-click on the Python 3.7 shortcut
    Image
    After that, it will show you the real exe path. For example, my Python 3.7 is in VS dir.
    Image

  2. After that you can do like what you did:

    Settings -> Project Interpreter -> Settings -> Add -> System Interpreter -> Base Interpreter -> ...
    (Sorry but I can't take screenshots for this step. Do what you did and it should be ok.)



Related Topics



Leave a reply



Submit