Python 3 不是我的默认版本。我想使用它,因为我想使用的一个包 toripchanger
只能在 Python3 下使用。
所以我的 pip3
版本是:
C:\Users\Truc>pip3 -V
pip 19.0.2 from c:\python\python37\lib\site-packages\pip (python 3.7)
当我运行命令时
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\
我已经尝试过了
pip3 install setuptools
还有这个
pip3 install wheel
因为我在另一个主题中看到了这一 pip ,但它不起作用,并且出现了相同的错误。
最佳答案
听起来您不具备构建扭轮的要求。
我确信在 Windows 上为 python 编译任何东西都需要 Visual C++ Build Tools ,安装这些可能足以让您的 pip 命令正常工作。
另一种解决方案是从 https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted 下载预构建的解决方案。并安装它。 (pip3 install file_you_downloaded.whl
)
一旦安装了twisted,请尝试再次安装scrapy。
关于python - pip3 install scrapy 不起作用并返回错误代码1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54736716/