在用scrapy框架实现爬虫时,scrapy导包报错:
Command “D:\Python\Anaconda\python.exe -u -c “import setuptools, tokenize;file=‘C:\Users\ADMINI~1\AppData\L
ocal\Temp\pip-install-831gxniz\Twisted\setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().repl
ace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record C:\Users\ADMINI~1\AppData\Local
\Temp\pip-record-xpf5dcsl\install-record.txt --single-version-externally-managed --compile” failed with error code
1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-831gxniz\Twisted\
于是pip install Twisted 安装Twisted包,接着报错:
Command “D:\Python\Anaconda\python.exe -u -c “import setuptools, tokenize;file=‘C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-nolnpe9o\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\ADMINI~1\AppData\Local\Temp\pip-record-7qsob_ng\install-record.txt --single-version-externally-managed --compile” failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-nolnpe9o\Twisted
在网上搜资料,答案是需要手动下载Twisted包
官网上:https://www.microsoft.com/zh-CN/download/details.aspx?id=52685
cp后面是python版本号,根据电脑系统安装的python版本进行相应下载即可。
下载完成后用命令行cmd进入你下载的twisted文件所在文件夹,执行操作:
pip install C:\Users\Administrator\Downloads\Twisted-19.2.1-cp37-cp37m-win_amd64.whl
提示成功:Successfully installed Twisted-19.2.1
然后pip install scrapy 安装scrapy包