欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Windows下安装Scrapy

程序员文章站 2022-05-09 22:48:56
...

使用版本:Python 3.7.6

所需文件:

lxml-4.5.0-cp37-cp37m-win_amd64.whl

pywin32-227-cp37-cp37m-win_amd64.whl

Twisted-19.10.0-cp37-cp37m-win_amd64.whl

这三个文件都可以直接百度搜索下载,cp37表示python版本是3.7,

1、使用Win+r,然后输入CMD,进入DOS窗口,

2、更新pip,命令:python -m pip --default-timeout=100 install --upgrade pip

3、安装wheel:pip install wheel

3、然后切换到已经下载了所需文件的目录,使用pip install xxxxxx 安装lxml、pywin32、Twisted

4、安装Scrapy:pip install scrapy,

安装期间遇到问题

pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files .pythonhosted.org', port=443): Read timed out.

查询后发现是pip下载超时问题,修改为:pip install --default-timeout=1000 scrapy

5、检测是否安装成功:dos窗口输入scrapy

C:\Users\Administrator>scrapy
Scrapy 1.8.0 - 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

 

相关标签: Python