pip3 install scrapy doesn't work and return a error code 1

∥☆過路亽.° 提交于 2020-01-24 19:33:32

问题


Python 3 is not my default version. I want to use it, because one the package I want to use toripchanger is only avaible under Python3.

So my pip3 version is:

C:\Users\Truc>pip3 -V
pip 19.0.2 from c:\python\python37\lib\site-packages\pip (python 3.7)

When I run the command

C:\Users\Truc>pip3 install scrapy
... #a lot of lines
#then
Command "c:\python\python37\python.exe -u -c "import setuptools, tokenize;
__file__='C:\\Users\\Truc\\AppData\\Local\\Temp\\pip-install-hw8khaqe\\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\Truc\AppData\Local\Temp\pip-record-msw6xh4l\install-record.txt 
--single-version-externally-managed 
--compile" 
failed with error code 1 in C:\Users\Truc\AppData\Local\Temp\pip-install-hw8khaqe\Twisted\

I already tried this

pip3 install setuptools

and this

pip3 install wheel

because I saw that in another topic, but it does not work and I get the same error.


回答1:


It sounds like you don't have the requirements for building the twisted wheel.
I know for sure compiling anything for python on windows requires the Visual C++ Build Tools, and installing those might be enough to get your pip command to work.

Another solution would be to download a pre-built one from https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted and install it. (pip3 install file_you_downloaded.whl)
Once twisted is installed, try installing scrapy again.




回答2:


Maybe for your case the best choice is to install Anaconda or Miniconda tools.




回答3:


Try updating:

pip3 install --upgrade setuptools  


来源:https://stackoverflow.com/questions/54736716/pip3-install-scrapy-doesnt-work-and-return-a-error-code-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!