安装scrapy时出现gcc失败错误

问题描述:

当我安装scrapy时出现以下错误(命令'gcc'失败,退出状态为1).我正在使用 Centos,是的,我安装了最新版本的 gcc.但我不确定为什么会收到此错误.我尝试使用谷歌搜索它但找不到解决方案

When i am installing scrapy then i am getting the below error (command 'gcc' failed with exit status 1). I am using Centos, and yes i have the latest version of gcc installed. But i am not sure why i am getting this error. I tried googling it but could'nt find a solution

OpenSSL/crypto/crypto.c:在函数‘initcrypto’中:OpenSSL/crypto/crypto.c:817: 警告:函数的隐式声明‘ERR_load_crypto_strings’ OpenSSL/crypto/crypto.c:818: 警告:函数‘OpenSSL_add_all_algorithms’的隐式声明OpenSSL/crypto/crypto.c:832: 错误:'crypto_X509_New' 未声明(在此函数中首次使用) OpenSSL/crypto/crypto.c:833: 错误:'crypto_X509Name_New' 未声明(首次在此函数中使用)OpenSSL/crypto/crypto.c:834: 错误:'crypto_X509Req_New' 未声明(在此函数中首次使用) OpenSSL/crypto/crypto.c:835: 错误:'crypto_X509Store_New' 未声明(首次在此函数中使用)OpenSSL/crypto/crypto.c:836: 错误:'crypto_PKey_New' 未声明(在此函数中首次使用) OpenSSL/crypto/crypto.c:838: 错误:crypto_PKCS7_New"未声明(首次在此函数中使用)OpenSSL/crypto/crypto.c:839: 错误: ‘crypto_NetscapeSPKI_New’未声明(在此函数中首次使用) OpenSSL/crypto/crypto.c:859:错误:X509_FILETYPE_PEM"未声明(首次在此函数中使用)OpenSSL/crypto/crypto.c:860: 错误:'X509_FILETYPE_ASN1' 未声明(在此函数中首次使用) OpenSSL/crypto/crypto.c:863: 错误:‘EVP_PKEY_RSA’未声明(首次在此函数中使用)OpenSSL/crypto/crypto.c:864: 错误:'EVP_PKEY_DSA' 未声明(首先在此函数中使用)错误:安装脚本退出错误:命令gcc"失败,退出状态为 1

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 时也遇到同样的错误

I am also getting the same error when i am installing lxml

src/lxml/lxml.etree.c:162737:错误:‘XML_XPATH_UNKNOWN_FUNC_ERROR’未声明(首次在此函数中使用)src/lxml/lxml.etree.c:162747:错误:'XML_XPATH_INVALID_OPERAND' 未声明(在此首次使用函数) src/lxml/lxml.etree.c:162757: 错误:'XML_XPATH_INVALID_TYPE' 未声明(首次在此函数中使用)src/lxml/lxml.etree.c:162767: 错误:'XML_XPATH_INVALID_ARITY'未声明(首次在此函数中使用)src/lxml/lxml.etree.c:162777:错误:'XML_XPATH_INVALID_CTXT_SIZE' 未声明(在此首次使用函数) src/lxml/lxml.etree.c:162787: 错误:'XML_XPATH_INVALID_CTXT_POSITION' 未声明(在此首次使用函数)src/lxml/lxml.etree.c:163133:错误:‘LIBXSLT_VERSION’未声明(首次在此函数中使用)src/lxml/lxml.etree.c:163145:错误:'xsltLibxsltVersion' 未声明(首次在此函数中使用)src/lxml/lxml.etree.c:163157: 错误:‘__pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER’未声明(第一次使用在这个函数中)src/lxml/lxml.etree.c:163157: 错误:'xsltDocDefaultLoader' 未声明(首次在此函数中使用)src/lxml/lxml.etree.c:163166: 错误:'__pyx_f_4lxml_5etree__xslt_doc_loader' 未声明(在此首次使用函数)错误:安装脚本退出并出现错误:命令gcc"失败退出状态为 1

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,您必须安装以下软件包.

You don't have the required C library to compile this module. For lxml, you have to install the following packages.

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

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

To resolve OpenSSL problem with Scrapy, install pyOpenSSL

sudo yum install pyOpenSSL

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

Note: These are the package names for fedora linux. Other distributions may have different package names.