简体   繁体   English

如何在命令提示符下使用 anaconda python

[英]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.我从其他帖子中了解到,为了使用 anaconda 安装的 python,我需要设置如下所示的环境变量。 As you can see, I put C:\Users\RT008840\Anaconda3\python.exe and C:\Users\RT008840\Anaconda3\Scripts at the top among other variables.如您所见,我将C:\Users\RT008840\Anaconda3\python.exeC:\Users\RT008840\Anaconda3\Scripts放在其他变量的顶部。
在此处输入图像描述

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 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?这里有什么遗漏的步骤吗? Thanks.谢谢。 在此处输入图像描述

PS 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 . PS我想在命令提示符下运行 python 的原因是我将不得不在 SQL Server 2008 中运行一些 python 脚本, 这里建议使用 xp_cmd。

I think, you need to use Anaconda prompt instead of normal command prompt我认为,您需要使用Anaconda prompt而不是普通的command prompt

Remove python.exe from the path.从路径中删除python.exe Only the folder location is needed.只需要文件夹位置。
To verify this location, open the anaconda prompt and then use where python .要验证此位置,请打开 anaconda 提示符,然后使用where python It detects the correct python location.它检测到正确的 python 位置。
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.另外我不认为将路径保持在顶部是强制性的,即使它不在顶部也会起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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