2011-04-21 99 views
2

如果我使用--no-site-packages中選擇,而創建的virtualenv並嘗試安裝MySQL-python的事後,我得到:的virtualenv GCC錯誤

error: command 'gcc' failed with exit status 1 

下面是我遵循的步驟:

easy_install-2.7 --install-dir ~/src/lib/ virtualenv==dev 
~/src/lib/virtualenv --no-site-packages ENV 
.../ENV/bin/pip-2.7 install MySQL-python 

我也嘗試下載的mysql-Python和安裝使用

.../ENV/bin/python setup.py build 

我得到同樣的錯誤枯萎的方式。 我假設我錯過了這個virtualenv的gcc,但是如何在仍使用--no-site-packages選項的情況下將它安裝在這個virtualenv中。 謝謝

編輯:按照下面的註釋這裏是整個錯誤輸出。

running build 
running build_py 
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb 
running build_ext 
building '_mysql' extension 
gcc -m32 -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/opt/lampp/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv 
In file included from /opt/lampp/include/python2.7/Python.h:58, 
       from pymemcompat.h:10, 
       from _mysql.c:29: 
/opt/lampp/include/python2.7/pyport.h:849:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." 
In file included from /usr/include/mysql/my_config.h:11, 
       from _mysql.c:36: 
/usr/include/mysql/my_config_x86_64.h:1032:1: warning: "SIZEOF_LONG" redefined 
In file included from /opt/lampp/include/python2.7/Python.h:8, 
       from pymemcompat.h:10, 
       from _mysql.c:29: 
/opt/lampp/include/python2.7/pyconfig.h:989:1: warning: this is the location of the previous definition 
error: command 'gcc' failed with exit status 1 
+0

你會得到什麼編譯錯誤? – AndiDog 2011-04-21 13:44:25

+1

你看到了什麼錯誤?你爲什麼要通過你的virtualenv等等?你爲什麼不直接從那裏激活venv和pip? – 2011-04-21 13:45:12

+0

我不激活,因爲我不需要。如果我轉到virtualenv目錄並從那裏激活我的virtualenv python,則沒有區別。所有激活的做法是將這些放在路徑中,以便您可以使用virtualenv執行/ usr/bin/env python。我不是嗎? – biomed 2011-04-21 14:13:27

回答

0

您是否嘗試過使用sudo命令。我猜測你有許可問題,而不是其他問題。通常安裝會拋出這個錯誤,因爲它試圖訪問你不擁有的根權限的目錄。

+1

使用virtualenv的主要原因是我在一個系統上我不能sudo – biomed 2011-04-24 04:45:12

1

你需要mysql-devel包。要安裝,你需要指定實際的軟件包名稱 -

sudo apt-get install libmysql++-dev