Python 3.9.1 path variable

11k views Asked by At

Good day!

Installed the Python 3.9.1, checked "Add to path", the cmd did not work though. Added Environment Variable Path, both folder

C:\Users\XXXXX\AppData\Local\Programs\Python\Python39

(file manager opens the path to python.exe just fine) and script lines:

C:\Users\XXXXX\AppData\Local\Programs\Python\Python39

Still the commands python -version and pip --version do not work from the command line. Py --version works just fine though.

Anyone might share and idea what might be the reason?

2

There are 2 answers

0
sophros On

If you had Python installed in the system before, the new path is added at the end of PATH system variable and when system looks for python.exe it finds first the old version that is available under a different folder.

If you used a command window opened before the new version got installed, it is also possible that system variables did not reload. Close it and use a new one to check.

0
ekiim On

This happens more often than one would think.

When you installed python from python.org and follow the installer, post install, you should check your environment variables, and verify that you have no other python installation (or if you do just name them appropriately).

Often you can find that there is an Environment Variable, that includes a python version on the global Environment Variable Path.

To verify that you are targeting the correct python version put these two directories (replace, user and python version), at the top of your PATH (user's path), and check that there are no conflicts with the rest of the PATH variables.

C:\Users\XXXXX\AppData\Local\Programs\Python\PythonXX
C:\Users\XXXXX\AppData\Local\Programs\Python\PythonXX\Scripts