`anaconda` 是否为每个新环境创建一个单独的 PYTHONPATH 变量? [英] Does `anaconda` create a separate PYTHONPATH variable for each new environment?

查看:34
本文介绍了`anaconda` 是否为每个新环境创建一个单独的 PYTHONPATH 变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用 Continuum.io 的 Python Anaconda 发行版来完成 scipy 工作.
我已经能够启动并运行 Anaconda,但我不知道 Anaconda 是否为它创建的每个新环境创建了一个新的 PYTHONPATH 环境变量,或者它是否依赖于通用系统PYTHONPATH.

I am starting to work with the Python Anaconda distribution from Continuum.io to do scipy work.
I have been able to get Anaconda up and running, but I cannot tell whether Anaconda creates a new PYTHONPATH environment variable for each new environment it creates, or whether it relies on the common system PYTHONPATH.

我在文档中找不到任何相关信息.

I could not find any information on this in the documentation.

此外,当我执行 printenv 时,我在新创建的环境中没有看到 PYTHONPATH 变量——尽管我确实找到了一些新的 anaconda 创建的环境变量.

Further, when I did a printenv, I did not see a PYTHONPATH variable in the newly created environment --though I did find a few new anaconda created environment variables.

我能找到的最好的是 Anaconda 在 PATH 变量的头部添加了一些 Anaconda 目录和新的环境目录——但这不一定将新包与系统环境隔离,但它很近.

The best I can find is that Anaconda added some Anaconda directories and the new environment directory to the head of PATH variable --but this does not necessarily isolate the new package from the system environment but it is close.

有没有人知道这个问题的答案或找到解决这个问题的方法?

Does anyone know the answer to this question or found a way to deal with this concern?

推荐答案

不,Anaconda 环境唯一需要修改的是 PATH(以便它从环境中获取正确的 Python bin/ 目录,或 Scripts 在 Windows 上).

No, the only thing that needs to be modified for an Anaconda environment is the PATH (so that it gets the right Python from the environment bin/ directory, or Scripts on Windows).

Anaconda 环境的工作方式是它们硬链接安装到环境中的所有内容.出于所有意图和目的,这意味着每个环境都是 Python 和所有包的完全独立的安装.通过使用硬链接,这可以有效地完成.因此,没有必要弄乱 PYTHONPATH,因为环境中的 Python 二进制文件已经搜索了环境中的站点包,以及环境的库,等等.

The way Anaconda environments work is that they hard link everything that is installed into the environment. For all intents and purposes, this means that each environment is a completely separate installation of Python and all the packages. By using hard links, this is done efficiently. Thus, there's no need to mess with PYTHONPATH because the Python binary in the environment already searches the site-packages in the environment, and the lib of the environment, and so on.

这篇关于`anaconda` 是否为每个新环境创建一个单独的 PYTHONPATH 变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆