Python3 --- Scrapy安装

安装方式一:

如果使用的是PyCharm则File-->Settings-->Project Interpreter,选择绿色加号搜索Scrapy安装即可,如下图:

这里需要注意Manage Repositories可以配置成:

  • https://pypi.douban.com/simple/
  • http://mirrors.aliyun.com/pypi/simple/

安装方式二:

现在可以通过本地安装实现,安装步骤如下:

1、下载与系统对应的whl文件(下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/

2、通过pip install XXX.whl安装

在安装的过程中会遇到各种坑,列举如下:

坑一:

You are using pip version 9.0.1, however version 10.0.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

解决方法:

这里其实说的很明显,需要你升级pip执行python -m pip install --upgrade pip,这里要特别注意如果一旦执行中途出差,一定要删除已有的pip-10.0.1.dist-info

坑二:(我用的是python36,自己的错误信息忘记保存了,这里的错误信息是网上找的)

Command "d:\python\python27\python.exe -u -c "import setuptools, tokenize;__file
__='c:\\users\\admini~1\\appdata\\local\\temp\\pip-build-9gywq7\\Twisted\\setup.
py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\
n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\a
dmini~1\appdata\local\temp\pip-_jok3e-record\install-record.txt --single-version
-externally-managed --compile" failed with error code 1 in c:\users\admini~1\app
data\local\temp\pip-build-9gywq7\Twisted\

解决方法:

1、下载Twisted(下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/),注意下载的版本与环境一致即可

2、通过pip install TwistedXXX.whl安装

坑三:

万恶的Read Time Out

这个。。。。。。遇到了就只有喝杯咖啡,玩玩手机

参考资料:

Scrapy爬虫入门教程一 安装和基本使用 
Scrapy爬虫入门教程二 官方提供Demo 
Scrapy爬虫入门教程三 命令行工具介绍和示例 
Scrapy爬虫入门教程四 Spider(爬虫) 
Scrapy爬虫入门教程五 Selectors(选择器) 
Scrapy爬虫入门教程六 Items(项目) 
Scrapy爬虫入门教程七 Item Loaders(项目加载器) 
Scrapy爬虫入门教程八 交互式 shell 方便调试 
Scrapy爬虫入门教程九 Item Pipeline(项目管道) 
Scrapy爬虫入门教程十 Feed exports(导出文件) 
Scrapy爬虫入门教程十一 Request和Response(请求和响应) 
Scrapy爬虫入门教程十二 Link Extractors(链接提取器)

猜你喜欢

转载自blog.csdn.net/ka_ka314/article/details/81064127