I guess most of us are aware of the fact that syntax in Python 2.x series are a little different than the Python 3.x series. Obviously, there can be a situation where you have to change the interpreter version for the program run. Especially when your IDE is Pycharm everything is quite easy. If you are looking for how to change the python version in PyCharm? I think this article is just for you.
Steps to change python version in pycharm-
Step 1 :
- Check if you already have that version interpreter of Python pre-installed. Suppose if you have Python 3.7 but you need a virtual env in pycharm for 2.7 base interpreter. In order to check it, Go to –
File -> Settings -> Project ->Project Interpreter
how to change python version in pycharm step 1
Refer to the above diagram, Here click on the drop-down of the Project Interpreter row ( Where the No Interpreter is mention). It will show you the name and path of the Interpreter which are already configured. All you need to select one of them if they are available at Run time Configuration in Pycharm ( Hint Run -> Edit Configurations).
In case the desire interpreter is not available. Go and install the required from https://www.python.org/downloads/
There is a dedicated tutorial on how to install python in you Opearting System. Follow the steps to install it.
Step 3 :
Set the path in the system variable. Especially while installing from Python.org window installer, It will show you the option to set the path automatically with the installation. In case you do not opt for it. Go and manually add it.
Step 4 :
Now once you have done to step 3, Restart the Pycharm and select the desired interpreter in Run -> Edit Configurations inside Pycharm IDE. Now you may use this global python interpreter for the project. But in case you want to create the virtual env based on this interpreter. You may go to File -> Settings -> Project ->Project Interpreter and click on the setting icon and choose to add.
Refer to the above image and change the base Interpreter here. Here you may choose the one which is the newest you installed. Here you may choose the conda env as the Interpreter also. It is just to make sure that pycharm is fully configurable with a variety of Interpreters.
How to downgrade python version in pycharm
In the above steps you have understood how to the edit configuration for the python interpreter. You can easily select the version of the python you want to to use or downgrade using it. This way you can easily downgrade python version in pycharm.
You can download the pycharm IDE from here.
This is a generic way to deal with python versioning with pycharm. It will remain same in most of the platform or operating system like mac, Linux or Windows etc. Now next to it is pycharm exploration. Just like, there are some other important configurations with pycharm like increasing memory in Pycharm and Installing packages in pycharm which we understand as next step.
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.