使用pip安装Scrapy出错

本文介绍了在Ubuntu系统中使用pip安装Scrapy时遇到cryptography安装错误的问题及解决方法。问题表现为在安装过程中出现cryptography安装失败的情况。解决该问题需要先安装一些依赖库。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装Scrapy出错

安装

使用pip安装(Ubuntu)

# 安装pip
sudo apt install python-pip # python2
sudo apt install python3-pip # python3
# python3
sudo pip3 install Scrapy
# python2
sudo pip install Scrapy

错误

cryptography安装出错

使用pip安装Scrapy时:

...
...
Requirement already satisfied: pycparser in /usr/local/lib/python3.5/dist-packages (from cffi>=1.4.1->cryptography>=1.3.4->pyOpenSSL->Scrapy)
Installing collected packages: cryptography, pyOpenSSL, service-identity, Scrapy
  Found existing installation: cryptography 1.2.3
    Uninstalling cryptography-1.2.3:
      Successfully uninstalled cryptography-1.2.3
  Running setup.py install for cryptography ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-cye1ome_/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-q_y00_ho-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/cryptography
    copying src/cryptography/exceptions.py -> build/lib.linux-x86_64-3.5/cryptography
    copying src/cryptography/__init__.py -> build/lib.linux-x86_64-3.5/cryptography
    copying src/cryptography/fernet.py -> build/lib.linux-x86_64-3.5/cryptography
...
...
解决方法

点击查看原文

可能的原因: 缺少依赖库.

for Ubuntu

python2

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

python3

sudo apt-get install build-essential libssl-dev libffi-dev python3-dev

转载于:https://www.cnblogs.com/bovenson/p/6595644.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值