Search code examples
pythonanaconda3

how to use anaconda python in command prompt


I learned from other posts that in order to use python installed by anaconda, I need to set up environmental variable shown below. As you can see, I put C:\Users\RT008840\Anaconda3\python.exe and C:\Users\RT008840\Anaconda3\Scripts at the top among other variables.

enter image description here

However, when going back to the command prompt with where python, the output is still C:\Users\RT008840\AppData\Local\Microsoft\WindowsApps\python.exe instead of my python path from anaconda C:\Users\RT008840\Anaconda3\python.exe

Any missing steps here?

enter image description here

P.S. The reason I want to run python in the command prompt is that I will have to run some python scripts in the SQL Server 2008 in the future with xp_cmdshell that suggested from here.


Solution

  • Removepython.exe from the path. Only the folder location is needed.
    To verify this location, open the anaconda prompt and then use where python. It detects the correct python location.
    Also I don't think that keeping the path at the top is mandatory, it will work even if it is not on the top.