2014-12-24 59 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

相關問題