windows下使用pip安装模块发生“failed with error code 1”的解决方法
来源:互联网 发布:制定项目计划 软件 编辑:程序博客网 时间:2024/06/05 18:13
win不愧是最烂的开发平台,在安装第三方模块时经常出现些幺蛾子。
今天在window中使用python3自带的pip安装scrapy时,出错,错误代码如下:
Command "f:\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\WONDER~1\\AppData\\Local\\Temp\\pip-build-90gvzc6m\\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\WONDER~1\AppData\Local\Temp\pip-2xl1_rnm-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\WONDER~1\AppData\Local\Temp\pip-build-90gvzc6m\Twisted\
关键词是:failed with error code 1
事实上,这个错误码之前在安装pandas时也出现过,当时不了了之了。
现今推测出现这个错误代码的原因有不少:
- pip版本过低
- 未安装wheel模块。虽说wheel模块在安装scrapy时应该会被自动安装。
- 要安装的模块不支持当前python版本。这个问题在python3上尤为明显。(scrapy就是不能完美支持3)
- 电脑的名称含有中文或其他稀奇古怪的非字母、数字的字符。
- 电脑虚拟内存不足。这条有点扯,但是我百度的时候还有不少人提到这一点,也不知道是不是转载的同一人的结论。
- 水逆。
(如今看来应该是要安装的模块缺少依赖包,因为我在一台新的CentOS上配置环境时,也碰见过类似的代码——于2017.09.22)
要解决它,最简单的莫过于别用Windows了,用Linux去。当然,也Windows下的python3也不是不能用这些第三方模块,只不过需要自己手动安装这些模块,而不要使用pip了。缺点是,很多情况下搞不清包与包之间的依赖,经常会漏包。
根据不同的模块,去查阅其各自的说明文档,一般都会有安装方式的说明。像scrapy的官方文档就推荐了安装方式:使用Mingwpy。
有或者,可以直接使用集成的第三方开发环境,比如在配置机器学习的环境时,直接使用了Anaconda。
对于winx下python3.6安装scrapy,我又仔细看了看错误代码,确定是安装twisted时出了问题。经过网上搜索,找到了一个解决方案(转自http://blog.csdn.net/nima1994):
首先从http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted 下载twisted对应版本的whl文件(如我的Twisted‑17.5.0‑cp36‑cp36m‑win_amd64.whl),cp后面是Python版本,amd64代表64位,运行命令:
pip install D:\TDownloads\Twisted-17.5.0-cp36-cp36m-win_amd64.whl
其中install后面为完整路径名
安装完成后,再次运行:
pip install Scrapy
即可成功。
- windows下使用pip安装模块发生“failed with error code 1”的解决方法
- pip安装软件时出现Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build*的解决方案
- pip安装软件时出现Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build*的解决方案
- pip安装软件时出现Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build*的解决方案
- 关于Python安装模块出现error: command 'gcc' failed with exit status 1错误的解决方法
- 安装jupyter的过程中出现Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-qMLlkr/
- 有关Error - RtlWerpReportException failed with status code :-1073741823.的解决方法
- 安装pyspider 时遇到failed with error code pip-build-IAIcv8/pycurl
- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-o2julgbe/xgboost/
- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-b2PICB/unroll/
- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-GVQWxt/ipython/
- windows下使用pip安装python模块lxml
- windows下使用pip安装python模块时报错总结
- python在windows下使用pip安装wordcloud模块失败
- CentOS7上 pip install MySQL-python 安装失败(error: command 'gcc' failed with exit status 1)的解决办法
- 【python】Windows下使用pip安装python模块时遇到的问题解决
- xcode编译时候出现clang: error: linker command failed with exit code 1 (use -v to see invocation)的解决方法
- compile" failed with error code 1 解决办法
- Windows10下配置CodeBlocks+OpenCV+MinGW
- 高并发下Linux内核参数调整
- 某安全浏览器竟然也被查出高危漏洞?开源安全问题不容忽视
- HDU6138 Fleet of the Eternal Throne
- -bash: lean: command not found
- windows下使用pip安装模块发生“failed with error code 1”的解决方法
- mysql 常用sql语句优化原则
- 大数据平台搭建(hadoop+spark)
- linux命令之tar
- 线上数据迁移操作-附阿里云DTS数据迁移介绍
- C# 命名规范
- 简单说 通过JS的隐式转换,关键时刻救你一命
- angularJS 手动启动
- mybatis generator逆向工程的生成