Python 是否将 Anaconda 添加到 Path
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45185057/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Adding Anaconda to Path or not
提问by Xaser
The official recommendation is not to add Anaconda / Python to the Windows PATH
environment variable. But how can I ensure then that my custom build scripts find python? (e.g. my sphinx
make.bat
).
官方建议不要在 WindowsPATH
环境变量中添加 Anaconda/Python 。但是我如何确保我的自定义构建脚本找到 python?(例如我的sphinx
make.bat
)。
采纳答案by Mike Müller
UPDATE
更新
Current Anaconda installations offer an "Anaconda Prompt" that has conda
on the path. Go to the Windows start button (Window icon) and start typing anaconda
. You should see an entry "Anaconda Prompt". Click on it. A new window opens that has conda
in the search path. Use as many Anaconda prompts as needed.
当前的 Anaconda 安装提供conda
了路径上的“Anaconda Prompt” 。转到 Windows 开始按钮(窗口图标)并开始输入anaconda
. 您应该会看到一个条目“Anaconda Prompt”。点击它。将打开一个新窗口,其中包含conda
搜索路径。根据需要使用尽可能多的 Anaconda 提示。
Old Answer
旧答案
A good way is to work with conda
environments.
一个好方法是使用conda
环境。
Add the path where the
conda.exe
to thePATH
temporally:set PATH=C:\my\path\to\conda;%PATH%
Create a new environment:
conda create -n py36 python=3.6
Activate it:
activate py36
添加的路径,其中
conda.exe
的PATH
时间:set PATH=C:\my\path\to\conda;%PATH%
创建新环境:
conda create -n py36 python=3.6
激活它:
activate py36
Now the prompt should change to py36
and all should work since all needed paths are set. You need to install all your packages you need for your project while this environment is activated. When done deactivate it with deactivate
.
现在提示应该更改为py36
并且所有都应该工作,因为所有需要的路径都已设置。在此环境激活时,您需要安装项目所需的所有软件包。完成后使用deactivate
.