Windows:conda 可以识别,python 不能
当我尝试从命令提示符或 Windows powershell 使用 python 时,出现“未找到 Python”的错误。这种情况是在我最近重新安装 Anaconda 后开始发生的,这就是我安装和管理 python 及相关包的方式。
奇怪的是“conda --version”在命令提示符下工作正常。另外,“python --version”在 Anaconda 提示符下工作正常。但是,我已将 Anaconda 提示符中“where python”的输出以及“where conda”的输出添加到环境变量下的用户变量“Path”中。我会注意到,这是在我的用户目录中,其中名称中包含空格,但 conda 路径定义也是如此,并且似乎工作得很好。
Windows 10 企业版、conda 4.10.3、python 3.9.7。谢谢。
When I try to use python from either command prompt or windows powershell, I get the error that "Python was not found". This started happening after I recently reinstalled Anaconda, which is how I install and manage python and related packages.
What's odd is that "conda --version" works fine in command prompt. Also, "python --version" works fine in Anaconda prompt. But, I have added the output of "where python" in the Anaconda prompt to the user variable "Path" under environment variables, along with the outputs of "where conda". I'll note that this is within my user directory, which contains a space in the name, but the same is true for the conda path definition and that seems to work just fine.
Windows 10 Enterprise, conda 4.10.3, python 3.9.7. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可能已经回答了我自己的问题,尽管我不完全理解为什么需要修复。
我在 powershell 中尝试了“conda activate base”,但失败并告诉我运行“conda init”,我执行了该操作,然后重新启动了 powershell。它现在在基础环境中打开,现在一切似乎工作正常。我不记得以前必须这样做,我想是因为 anaconda 更新(在我重新安装时应用)使用了所需的环境,而以前不是。不确定这是正确的解释,所以我将暂时保留这一点,但这似乎确实解决了我的问题。
I may have already answered my own question, though I don't fully understand why the fix was needed.
I tried "conda activate base" in powershell and it failed and told me to run "conda init ", which I did and then restarted powershell. It now opens in the base environment and things seem to work fine now. I don't remember having to do this before, I think because an anaconda update (applied when I reinstalled) made using an environment required whereas it wasn't before. Not sure that's the right explanation so I'll leave this up for a bit, but this did seem to fix my issue.