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

查看:126
本文介绍了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(以便它从环境bin/目录中获取正确的Python,或Windows上的Scripts\.

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二进制文件已经在环境中搜索了站点包以及环境的lib等.

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天全站免登陆