pip install Scrapy报错及解决方法

以下是我个人在安装scrapy时遇见的问题及我的解决方法

(1)运行命令

pip install Scrapy

在执行到“Collecting Twisted>=13.1.0 (from Scrapy)”时报错:Exception:Traceback (most recent call last).....

原因:我当前的版本是pip 9.0.1,需要升级到9.0.3

运行命令:

python -m pip install --upgrade pip


(2)升级后再次执行

pip install Scrapy

报错:Command "python setup.py egg_info" failed with error code 1 in C:\Users\LUOXIA~1\AppData\Local\Temp\pip-build-5hi6welx\Twisted\Complete output from command python setup.py egg_info:

原因:setup.py的版本问题

运行命令:

pip install setuptools==33.1.1


(3)再次执行

pip install Scrapy

报错“Command ""c:\program files\python36\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\LUOXIA~1\\AppData\\Local\\Temp\\pip-build-rdyp2fl9\\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\LUOXIA~1\AppData\Local\Temp\pip-pge7_20d-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\LUOXIA~1\AppData\Local\Temp\pip-build-rdyp2fl9\Twisted\”

解决方法:下载安装twisted对应版本的whl文件,比如:我的是Twisted-17.9.0-cp36-cp36m-win_amd64.whl,cp后面是python版本,amd64代表64位

下载网址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted

运行命令:

pip install F:\python\mytool\Twisted-17.9.0-cp36-cp36m-win_amd64.whl

其中install后面为下载的whl文件的完整路径名

(4)安装完成后,再次运行:

pip install Scrapy

报错:Collecting pyasn1 (from service-identity->Scrapy)

  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)

原因:缺少pyasn1

运行命令:

pip install pyasn1


(5)再次运行命令
pip install Scrapy
终于成功了

pip install Scrapy报错及解决方法_第1张图片


你可能感兴趣的:(学习笔记)