2014-12-24 35 views
3

在机器上安装Anaconda时,创建使用与机器的默认Python不同的Python版本的virtualenv时发生错误。 我创建了一个新的虚拟环境:使用Anaconda的Python版本创建virtualenv

virtualenv --no-site-packages ~/graphlabcreate 
source ~/graphlabcreate/bin/activate 

创建一个目录,本机默认python2.6的,而我需要python2.7。然后,我读here,并试图:

virtualenv -p /usr/local/anaconda/bin/python2.7 ~/graphlabcreate

而且收到以下错误:

Running virtualenv with interpreter /usr/local/anaconda/bin/python2.7 
New python executable in /home/nancy/graphlabcreate/bin/python2.7 
Not overwriting existing python script /home/nancy/graphlabcreate/bin/python (you must use /home/nancy/graphlabcreate/bin/python2.7) 
/home/nancy/graphlabcreate/bin/python2.7: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory 
ERROR: The executable /home/nancy/graphlabcreate/bin/python2.7 is not functioning 
ERROR: It thinks sys.prefix is u'/' (should be u'/home/nancy/graphlabcreate') 
ERROR: virtualenv is not compatible with this system or executable 

同样的情况,当我运行:

virtualenv -p /usr/local/anaconda/bin/python2.7 --no-site-packages ~/graphlabcreate 

编辑:

$ ls -ltr /usr/bin/pyth* 
-rwxr-xr-x. 1 root root 1418 2013-11-21 17:51 /usr/bin/python2.6-config* 
-rwxr-xr-x. 3 root root 9032 2013-11-21 17:53 /usr/bin/python2.6* 
-rwxr-xr-x. 3 root root 9032 2013-11-21 17:53 /usr/bin/python* 
lrwxrwxrwx. 1 root root 6 2014-07-15 12:51 /usr/bin/python2 -> python* 
lrwxrwxrwx. 1 root root 16 2014-07-15 12:56 /usr/bin/python-config -> python2.6-config* 

$ ls -ltr /usr/local/anaconda/bin/pyth* 
    -rwxr-xr-x. 3 root root 9032 2013-11-21 17:53 /usr/local/anaconda/bin/python* 
    -rwxr-xr-x. 1 root root 10222 2014-06-02 20:35 /usr/local/anaconda/bin/python2.7* 
    -rwxrwxr-x. 1 root root 1602 2014-07-16 17:21 /usr/local/anaconda/bin/python-argcomplete-check-easy-install-script* 
    lrwxrwxrwx. 1 root root  9 2014-07-16 17:21 /usr/local/anaconda/bin/python2 -> python2.7* 
    -rwxr-xr-x. 1 root root 1680 2014-07-16 17:21 /usr/local/anaconda/bin/python-config* 

回答

1

如果您使用的是Anaconda,则可以使用conda create命令,使用conda创建环境而不是virtualenv。

-1

你可以简单介绍一下,你是如何安装这个版本的python的。并尝试在哪个操作系统上安装。

如果python2.6是你的Os的默认值。那么你需要做ALT安装蟒蛇的其他较新的版本(因此,它会不会与你的OS冲突),并创建符号链接到Python

类似下面

焦油-zxvf的Python 2.7.6 .tgz的

CD Python的2.7.6

的./configure前缀=的/ usr /本地--with线程--enable共享

使& &化妆altinstall

LN -s在/ usr/local/bin目录/蟒蛇/usr/bin/python2.7

回声 '的/ usr/local/lib目录' >> /etc/ld.so.conf.d/usr- python2.7.conf

LDCONFIG

之后,你尝试安装虚拟ENV库,然后尝试你现在在做什么。

希望你有一些想法。 :)

+0

操作系统:centus6。我不记得我是如何安装python版本的,但是anaconda包含python2.7。 – Serendipity

+0

看来我已经有一个链接: $〜/ graphlabcreate/bin $ ll total 12 lrwxrwxrwx。 1 nancy nancy 9 2014-12-24 08:43 python - > python2.7 * lrwxrwxrwx。 1 nancy nancy 9 2014-12-24 08:43 python2 - > python2.7 * -rwxr-xr-x。 1 nancy nancy 10222 2014-12-24 08:43 python2.7 * – Serendipity

+0

https://github.com/h2oai/h2o/wiki/Installing-python-2.7-on-centos-6.3.-Flow-this-sequence-仅限于centos-machine-only验证上述链接。可能会有用。 – vijay