解决Mac安装scrapy失败的问题

yipeiwu_com5年前Python基础

今天打算弄个爬虫,想来想去打算用python弄一个。之前了解到scrapy这个库是个不错的选择,于是开始折腾。可惜第一步就挂了。

安装scrapy库就不成功:

Installing collected packages: six, w3lib, parsel, pyasn1, pyasn1-modules, attrs, service-identity, scrapy
 Found existing installation: six 1.4.1
 DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
 Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
 File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
 status = self.run(options, args)
 File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
 prefix=options.prefix_path,
 File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
 requirement.uninstall(auto_confirm=True)
 File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
 paths_to_remove.remove(auto_confirm)
 File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
 renames(path, new_path)
 File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
 shutil.move(old, new)
 File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
 copy2(src, real_dst)
 File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
 copystat(src, dst)
 File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
 os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/r9/35q9g3d56_d9g0v59w9x2l9w0000gn/T/pip-oWMyqW-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

果断google+stackoverflow。

结论是:

http://stackoverflow.com/questions/31900008/oserror-errno-1-operation-not-permitted-when-installing-scrapy-in-osx-10-11

brew install python

原因是旧的python版本在新的mac系统上有些问题。升级一下就好了。

以上这篇解决Mac安装scrapy失败的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

彻底搞懂Python字符编码

彻底搞懂Python字符编码

不论你是有着多年经验的 Python 老司机还是刚入门 Python 不久,你一定遇到过UnicodeEncodeError、UnicodeDecodeError 错误,每当遇到错误我们...

Django添加KindEditor富文本编辑器的使用

KindEditor简介: KindEditor是一套开源的在线HTML编辑器,主要用于让用户在网站上获得所见即所得编辑效果,开发人员可以用KindEditor 把传统的多行文本输入框...

matplotlib给子图添加图例的方法

matplotlib给子图添加图例的方法

代码如下: import matplotlib.pyplot as plt x = [1,2,3,4,5,6,7,8] y = [5,2,4,2,1,4,5,2] axe1 = p...

Python生成随机验证码的两种方法

使用python生成随机验证码的方法有很多种,今天小编给大家分享两种方法,大家可以灵活运用这两种方法,设计出适合自己的验证码方法。 方法一: 利用range方法,对于range方法不清楚...

python无限生成不重复(字母,数字,字符)组合的方法

使用python自带的itertools模块 调用其product函数 传入我们想组合生成的字符数据 便会源源不断的生成组合 而且不会重复 repeat参数指定生成多少位 impor...