简体   繁体   中英

Python path on windows

I have two installations of Python on a corporate Windows computer. One from the Anaconda distribution:

C:\Users\Me\AppData\Local\Continuum\anaconda3\python3.exe

Another one from a corporate installer:

C:\Users\Me\AppData\Local\Downloaded Apps\WinPython\python-3.4.3\python.exe

If I type "python" in the default "cmd" terminal or in the Git Bash, it says "command not found". Probably for the same reason, Jupyter does not allow me to create a Python 3 notebook. How do I set the paths so that Python is available system-wide? I prefer the Anaconda distribution's Python.

EDIT: Creating a new user variable PYTHONPATH and setting it to C:\\Users\\Me\\AppData\\Local\\Continuum\\anaconda3\\ via Windows System Properties does not have an effect.

This answer describes step-by-step an approach that worked for me. However, as eryksun notes in the comment, the additional variable should not be named PYTHONPATH . I renamed it PYTHON , which works.

Strangely, adding the paths directly to the PATH variable did NOT work.

You have to add the path of your installation to the Environment variables. Simply go to the System Properties / Environment Variables / From there, create a new system variables and add your python path.

In the system variable section select the Path variable. Add new variable C:\\Users\\Me\\AppData\\Local\\Continuum\\anaconda3\\ as environment variable in your advanced System Settings. This is from where your system will invoke the python interpreter.

For more details see this answer

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