Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pycharm's terminal doesn't change the Python version corresponding to Python version at Project Interpreter

I have installed PyCharm 2016.3 and installed two version of Python (3.5.2 and 2.7.9) on Windows. I would like to use both of these version, so I configured it at the Project Interpreter window. I chose the 3.5.2 version like the image below

enter image description here

After that I opened the Python Console, everything works fine with the 3.5.2 version of Python. But when I open the Terminal and press python --version, the version was still not changed.

enter image description here

I couldn't run the server with the statement python manage.py runserver because the project contains some code which could only be ran in Python 3.x, not 2.x.

How can I fix this problem?

like image 323
Linh Văn Avatar asked Dec 20 '16 07:12

Linh Văn


People also ask

How do I change Python interpreter version?

Change the Python interpreter in the project settingsPress Ctrl+Alt+S to open the IDE settings and select Project <project name> | Python Interpreter. Expand the list of the available interpreters and click the Show All link. Select the target interpreter.

How do I select Python interpreter in terminal?

By default, the Python extension looks for and uses the first Python interpreter it finds in the system path. To select a specific environment, use the Python: Select Interpreter command from the Command Palette (Ctrl+Shift+P). Note: If the Python extension doesn't find an interpreter, it issues a warning.

How do I change the default version of Python in CMD?

Always type py instead of python when running a script from the command line. Set your preferred default version by setting the PY_PYTHON environment variable (e.g. PY_PYTHON=3.7) . You can see what version of python is your default by typing py .


1 Answers

PyCharm Terminal is your local system terminal, as it can be seen in the official PyCharm website.

So you need to make sure that your local python, points to the python setup version you want.

For Linux, something like that:

alias python=/usr/local/bin/python3.5

For Windows you may find helpful this discussion.

like image 99
afxentios Avatar answered Oct 09 '22 07:10

afxentios