安装scrapy报错error: command 'x86_64-linux-gnu-gcc' failed with exit status 1处理

报错信息如下:

 building '_openssl' extension
    creating build/temp.linux-x86_64-2.7/build
    creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-oH9M6v/python2.7-2.7.12=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o
    build/temp.linux-x86_64-2.7/_openssl.c:434:30: fatal error: openssl/opensslv.h: 没有那个文件或目录
     #include <openssl/opensslv.h>
                                  ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 Command "/home/echo/workspace/learnscrapy/venv/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9Rii3g/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-mgCoV9-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/echo/workspace/learnscrapy/venv/include/site/python2.7/cryptography" failed with error code 1 in /tmp/pip-build-9Rii3g/cryptography/

意思是在安装的时候找不到openssl.h这个头文件,在ubuntu14.04下使用下面命令可以解决这个问题:

sudo apt install libssl-dev

之后再执行pip install scrapy就不会报错了

    原文作者:罗盘上的方向
    原文地址: https://www.jianshu.com/p/710c95c3d897
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞