简体   繁体   中英

Python 3.9.1 path variable

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?

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

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.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM