2012-06-07 60 views
4

當我安裝scrapy時,我得到下面的錯誤(命令'gcc'失敗,退出狀態爲1)。我使用的是Centos,是的,我已安裝最新版本的gcc。但我不知道爲什麼我得到這個錯誤。我試着用搜索引擎,但could'nt找到一個解決方案安裝scrapy時出現gcc失敗錯誤

OpenSSL/crypto/crypto.c: In function ‘initcrypto’: OpenSSL/crypto/crypto.c:817: warning: implicit declaration of function ‘ERR_load_crypto_strings’ OpenSSL/crypto/crypto.c:818: warning: implicit declaration of function ‘OpenSSL_add_all_algorithms’ OpenSSL/crypto/crypto.c:832: error: ‘crypto_X509_New’ undeclared (first use in this function) OpenSSL/crypto/crypto.c:833: error: ‘crypto_X509Name_New’ undeclared (first use in this function) OpenSSL/crypto/crypto.c:834: error: ‘crypto_X509Req_New’ undeclared (first use in this function) OpenSSL/crypto/crypto.c:835: error: ‘crypto_X509Store_New’ undeclared (first use in this function) OpenSSL/crypto/crypto.c:836: error: ‘crypto_PKey_New’ undeclared (first use in this function) OpenSSL/crypto/crypto.c:838: error: ‘crypto_PKCS7_New’ undeclared (first use in this function) OpenSSL/crypto/crypto.c:839: error: ‘crypto_NetscapeSPKI_New’ undeclared (first use in this function) OpenSSL/crypto/crypto.c:859: error: ‘X509_FILETYPE_PEM’ undeclared (first use in this function) OpenSSL/crypto/crypto.c:860: error: ‘X509_FILETYPE_ASN1’ undeclared (first use in this function) OpenSSL/crypto/crypto.c:863: error: ‘EVP_PKEY_RSA’ undeclared (first use in this function) OpenSSL/crypto/crypto.c:864: error: ‘EVP_PKEY_DSA’ undeclared (first use in this function) error: Setup script exited with error: command 'gcc' failed with exit status 1

我也收到同樣的錯誤,當我安裝LXML

src/lxml/lxml.etree.c:162737: error: ‘XML_XPATH_UNKNOWN_FUNC_ERROR’ undeclared (first use in this function) src/lxml/lxml.etree.c:162747: error: ‘XML_XPATH_INVALID_OPERAND’ undeclared (first use in this function) src/lxml/lxml.etree.c:162757: error: ‘XML_XPATH_INVALID_TYPE’ undeclared (first use in this function) src/lxml/lxml.etree.c:162767: error: ‘XML_XPATH_INVALID_ARITY’ undeclared (first use in this function) src/lxml/lxml.etree.c:162777: error: ‘XML_XPATH_INVALID_CTXT_SIZE’ undeclared (first use in this function) src/lxml/lxml.etree.c:162787: error: ‘XML_XPATH_INVALID_CTXT_POSITION’ undeclared (first use in this function) src/lxml/lxml.etree.c:163133: error: ‘LIBXSLT_VERSION’ undeclared (first use in this function) src/lxml/lxml.etree.c:163145: error: ‘xsltLibxsltVersion’ undeclared (first use in this function) src/lxml/lxml.etree.c:163157: error: ‘__pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER’ undeclared (first use in this function) src/lxml/lxml.etree.c:163157: error: ‘xsltDocDefaultLoader’ undeclared (first use in this function) src/lxml/lxml.etree.c:163166: error: ‘__pyx_f_4lxml_5etree__xslt_doc_loader’ undeclared (first use in this function) error: Setup script exited with error: command 'gcc' failed with exit status 1

+0

您是否使用'easy_install'安裝? –

+0

太本地化,不具建設性。 – markus

回答

14

您沒有必要的C庫編譯這個模塊。 對於lxml,您必須安裝以下軟件包。

sudo yum install python-devel libxml2-devel libxslt-devel 

要解決的OpenSSL問題Scrapy,安裝pyOpenSSL

sudo yum install pyOpenSSL 

注:這些是Fedora Linux系統的包名。其他發行版可能具有不同的軟件包名稱。

+0

在Debian上:'sudo apt-get install python-dev libxml2-dev libxslt-dev' – phirschybar

1

這是對Linux Mint的納迪亞,我的解決方案:

sudo apt-get install libxml2-dev libxslt-dev 

我已經有蟒蛇-dev的安裝。我注意到,一旦安裝了xml和xslt依賴項,pip就能爲我安裝pyOpenSSL。

+1

'sudo apt-get install libxml2-dev libxslt-dev' –

2

另外,還要確保你已經安裝GCC:

sudo yum install gcc 
0

我raspi自動更正爲

sudo apt-get install libxml2-dev libxslt1-dev 

我也跑:

sudo apt-get install libffi-dev 

不知道這是否是neccessary。

0

在Fedora 23上,我必須安裝以下軟件包才能成功完成$ pip install scrapy

sudo dnf install python-devel libxml2-devel libxslt-devel libffi-devel libffi-devel 

如果安裝程序報告缺少文件,例如:

fatal error: openssl/opensslv.h: No such file or directory 
    compilation terminated. 
    error: command 'gcc' failed with exit status 1 

$ dnf provides *filename(DNF提供*的OpenSSL/opensslv.h)找到所需的軟件包並安裝它。

相關問題