Reputation: 275
On Windows 10, I want to use Python 3.8, which I installed and downloaded.
However, in Visual Studio Code, the cmd
-environment, and PowerShell, the command python
returns 3.5.6, an Anaconda install.
In particular, the screenshot shows that (at the bottom left) the active interpreter should be 3.8.1; and the "Python Path" in the settings also directs to the correct path, but typing python
in Terminal just outputs 3.5.6.
In the PATH
-variable, I deleted the line that points to 3.5.6's directory, and added the directory of 3.8.1 (was done automatically during the install):
What more do I need to do?
Environment Variables are:
Path: C:\Users\d91776\AppData\Local\Programs\Python\Python38-32\Scripts\;C:\Users\d91776\AppData\Local\Programs\Python\Python38-32\;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Program Files\java\jdk\bin;C:\Program Files\Java\jdk1.8.0_191\bin;C:\Program Files\Java\jre1.8.0_191\bin;C:\Users\d91776\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\d91776\Desktop\Selenium Markitwire\geckodriver-v0.24.0-win64;C:\Users\d91776\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin;
PSModulePath: %HomeDrive%%HomePath%\Documents\WindowsPowerShell\Modules;C:\Users\d91776\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\PowerShell
TEMP and TMP: are both %USERPROFILE%\AppData\Local\Temp
There is another "Path" in System variables, but I cannot display it as text. But it does not seem to related to the python paths. See highlighted section in Screenshot:
In Anaconda, I deactivated the one additional environment that had Python version 3.5.6.
However, the problem now persists with Python version 3.7.3 (version of Python displayed upon typing python
in terminal) and 3.8.1 (selected in VS Code as Python interpreter, and displayed in the bottom-left, just as in the above screenshot).
C:\>python
Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
Type "help", "copyright", "credits" or "license" for more information.
Upvotes: 1
Views: 3656
Reputation: 126
Try this method which helped me with the same problem -
Let me know in comments if you still weren't able to change the version
Upvotes: 0
Reputation: 16080
The Python extension for VS Code does not influence what the python
command points at; that comes down to your PATH
environment variable. If you want to manually launch Python 3.8 then you should run python3.8
or py -3.8
(if you just want the newest Python 3 installed then change that to python3
or py -3
). Otherwise create a virtual environment with Python 3.8 and when it's activated python
will be Python 3.8.
As for why this doesn't work in PowerShell, it's possible the install of Python 3.8 that you used installed a python
command for Python 3.8 (you would have to check those directories on your PATH
to verify this).
Upvotes: 1