Ubantu平台安装Scrapy

命令:pip install Scrapy
查看报错,出什么错就解决什么问题
常见错误1:
 src/twisted/test/raiser.c:4:20: fatal error: Python.h: 没有那个文件或目录
 compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
上面的说明依赖包没有装完

解决方案:
 1、之前一直都是:sudo apt install python-dev  或者  sudo apt install python3-dev,结果都不成功,看了下原因:

1)

正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
python-dev 已经是最新版 (2.7.11-1)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。

2)

正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
python3-dev 已经是最新版 (3.5.1-3)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。

发现一个是2.7,一个是3.5

2、所以最后安装3.6版本的python-dev就可以了。·[解决方案]

sudo apt install python3.6-dev

常见错误2:
 Could not find a version that satisfies the requirement pyasn1 (from service-identity->Scrapy) (from versions: )
No matching distribution found for pyasn1 (from service-identity->Scrapy)

解决方案:

升级pip

常见错误3:
building ‘twisted.test.raiser’ extension
error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: https://visualstudio.microsoft.com/downloads/
解决方案

检测scrapy安装是否成功
命令:scrapy
出现:
Scrapy 1.5.1 - no active project

Usage:
  scrapy <command> [options] [args]

Available commands:
  bench         Run quick benchmark test
  fetch         Fetch a URL using the Scrapy downloader
  genspider     Generate new spider using pre-defined templates
  runspider     Run a self-contained spider (without creating a project)
  settings      Get settings values
  shell         Interactive scraping console
  startproject  Create new project
  version       Print Scrapy version
  view          Open URL in browser, as seen by Scrapy

  [ more ]      More commands available when run from project directory

Use "scrapy <command> -h" to see more info about a command

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值