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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 16:47:53  来源:igfitidea点击:

Adding Anaconda to Path or not

pythonwindowspathanacondaenvironment

提问by Xaser

The official recommendation is not to add Anaconda / Python to the Windows PATHenvironment variable. But how can I ensure then that my custom build scripts find python? (e.g. my sphinxmake.bat).

官方建议不要在 WindowsPATH环境变量中添加 Anaconda/Python 。但是我如何确保我的自定义构建脚本找到 python?(例如我的sphinxmake.bat)。

采纳答案by Mike Müller

UPDATE

更新

Current Anaconda installations offer an "Anaconda Prompt" that has condaon 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 condain 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 condaenvironments.

一个好方法是使用conda环境。

  1. Add the path where the conda.exeto the PATHtemporally:

    set PATH=C:\my\path\to\conda;%PATH%

  2. Create a new environment:

    conda create -n py36 python=3.6

  3. Activate it:

    activate py36

  1. 添加的路径,其中conda.exePATH时间:

    set PATH=C:\my\path\to\conda;%PATH%

  2. 创建新环境:

    conda create -n py36 python=3.6

  3. 激活它:

    activate py36

Now the prompt should change to py36and 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.