python - 安装scrapy时出现gcc失败错误

标签 python scrapy

当我安装 scrapy 时出现以下错误(command 'gcc' failed with exit status 1)。我正在使用 Centos,是的,我安装了最新版本的 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

最佳答案

您没有编译此模块所需的 C 库。 对于 lxml,您必须安装以下软件包。

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

要解决 Scrapy 的 OpenSSL 问题,请安装 pyOpenSSL

sudo yum install pyOpenSSL

注意:这些是 fedora linux 的包名称。其他发行版可能有不同的包名。

关于python - 安装scrapy时出现gcc失败错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10927492/

相关文章:

python - 将 pandas 管道中的一系列分隔(用等号)分成多列

Python 3-谷歌驱动器 API : AttributeError: 'Resource' object has no attribute 'children'

python - 用数组成员包装 C 结构以便在 python : SWIG? cython 中访问?类型?

python - 我如何在 AWS 负载均衡器上使用 ZeroMQ?

python - 有些网站被普通浏览器屏蔽,但在隐身模式下运行良好

python - scrapy重定向到127.0.0.1

python - 使用 Transformer 模型的多实例分类

python - 如何在linux上通过python代码进入文件夹

python - Scrapy 抑制处理的错误

python - xpath 标签不知道该放什么