编辑:这项工作的目的是建立一个conda环境来替代bash出口。因此,bash导出已被禁用。
我已经使用名为my_env
(与my_env.txt
相同)的预先安装的conda规范文件创建了名为requirment.txt
的本地conda虚拟环境。
conda create --prefix <path/to/my_env_directory> --file <path/to/my_env.txt>
i.e. conda create --prefix /hjs/jen/projects/my_env --file /hjs/jen/projects/project1/my_env.txt
然后将我的paths.pth
文件放置在/hjs/jen/projects/my_env/lib/python2.7/site-packages/paths.pth
但是,它找不到正确的本地PYTHONPATHS
,如下所示。
运行python -c "import sys; print '\n'.join(sys.path)"
来检查PYTHONPATHS
时,我得到
/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/hjs/jen/project/my_env/lib/python2.7/lib-dynload
/net/home/j/jen/.local/lib/python2.7/site-packages
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0
因此,基本上conda不应在PYTHONPATH
中找到任何/net/home/j/jen/.local/lib/python2.7/site-packages
,因为它不在本地环境中而是用户特定的(它在home
中,而jen
是用户名)但确实如此!
要对此进行测试,我在test_env.pth
创建了一个新的hjs/jen/projects/my_env/lib/python2.7/site-packages/test_env.pth
文件,并且确定没有找到这个新的PYTHONPATH
但是,当我重新创建环境并删除两个*.pth
文件并将它们替换为/net/home/j/jen/.local/lib/python2.7/site-packages/test_paths.pth
时,conda确实会像以前一样找到所有PYTHONPATHS
以及/hjs/jen/test_test
< / p>
/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/hjs/jen/project/my_env/lib/python2.7/lib-dynload
/net/home/j/jen/.local/lib/python2.7/site-packages
/net/home/j/jen/.local/lib/python2.7/site-packages
/hjs/jen/test_test
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0
因此,基本上我不希望conda在/net/home/j/jen/.local/lib/python2.7/site-packages
/中找到任何PYTHONPATH环境变量,而仅在hjs/jen/projects/my_env/lib/python2.7/site-packages/
中找到。我该如何实现?
其他信息:which python
仅显示env
内python的一个安装
我正在使用python 2.7