i just started using python and i use VS Code.
When i do
python --verion
i get python version 2
py --version
i get python version 3
i wanted to install networkx which turned out to only work with python version 3. I did multiple things to change python version to 3 but could not.
So i decided to uninstall python and went to control panel and uninstalled
python
python launcher
and restarted the computer.
But when i run
python --version
it still shows up python 2.7.18
and this is my where python output
can anyone please help me to understand whats going on and how can i get python 3 to my system.
My solution:
I had already tried putting the python 3.1 path (default added by python when you click add path option while installing) above all path but had no intended outcome.
What i did:
installed python again and this time added the path by myself and moved it to top.
Now when i run
where.exe python it shows me three path, i don't know much but looks like there are two/three python in the system but it started showing python 3 for now.
my where.exe python output:
uninstalled
In windows If you do not have correct environment variable set then this is likely to cause the problem.
On your Powershell if you type $env:path
or on command prompt echo %PATH%
you shall see your environment variable path which you have set,
where-in, either you may not have path to directory of Python 3 or you have it appended after Python2.
ie:
if your result show up as ( ...
could be other paths in your variable) then only you will get python.exe to be pointing to your Python3 path:
...
C:\Python38\Scripts;C:\Python38;
...
C:\Python27\Scripts;C:\Python27\;
...
You can download anaconda launcher and it has many python environments like jupyter notebooks or spyder with python 3 support
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.