I have just installed Anaconda on my computer because I need to use Numpy.
Well, when I use python I for some reason have to be in the same folder as python.exe
and, of course, now that I want to use Anaconda I have to be in the Anaconda3\Scripts
folder where python.exe
isn't. This is a nightmare, how can I use anaconda with python on a windows computer? Why does it have to be so complicated?
问题:
回答1:
I think you are referring to the command-line use of python
?
If you have admin priviliges on your machine you can add python
to your environment variables, making it available in the console anywhere. (Sorry for different spellings, I am not on an english machine)
- Press
Shift+Pause
("System") - Click "Advanced System Options"
- Click "Environment variables"
- In the lower field with "System variables" there is a variable called
PATH
. Append the complete path to yourpython.exe
without the file to that by adding a;
behind the last path in the variable and then adding your path. Do not add any spaces!
Example: C:\examplepath\;C:\Python27\
回答2:
When you install anaconda on windows now, it doesn't automatically add Python or Conda to your path.
If you don’t know where your conda and/or python is, you type the following commands into your anaconda prompt (it comes when you install anaconda)
Next, you can add Python and Conda to your path by using the setx command in your command prompt.
Next close that command prompt and open a new one. You should now be able to use the python command. To do this you open a command prompt and type
python nameofPythonfile.py
Source: https://medium.com/@GalarnykMichael/install-python-on-windows-anaconda-c63c7c3d1444
回答3:
To be able to do that in the command line you just have to add Python and also the Anaconda3\Scripts directory to your system path.
Here is a good tutorial on setting your path in Windows: http://www.computerhope.com/issues/ch000549.htm