Lui*_* U. 205 python macos scrapy python-2.7
我正在尝试通过pip在OSX 10.11(El Capitan)中安装Scrapy Python框架.安装脚本会下载所需的模块,并在某些时候返回以下错误:
OSError: [Errno 1] Operation not permitted: '/tmp/pip-nIfswi-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下命令停用OSX 10.11中的无根功能:
sudo nvram boot-args="rootless=0";sudo reboot
Run Code Online (Sandbox Code Playgroud)
但是当机器重新启动时我仍然会遇到同样的错误.
来自我的StackExchangers同事的任何线索或想法?
如果有帮助,则完整脚本输出如下:
sudo -s pip install scrapy
Collecting scrapy
Downloading Scrapy-1.0.2-py2-none-any.whl (290kB)
100% |????????????????????????????????| 290kB 345kB/s
Requirement already satisfied (use --upgrade to upgrade): cssselect>=0.9 in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): queuelib in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): pyOpenSSL in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from scrapy)
Collecting w3lib>=1.8.0 (from scrapy)
Downloading w3lib-1.12.0-py2.py3-none-any.whl
Collecting lxml (from scrapy)
Downloading lxml-3.4.4.tar.gz (3.5MB)
100% |????????????????????????????????| 3.5MB 112kB/s
Collecting Twisted>=10.0.0 (from scrapy)
Downloading Twisted-15.3.0.tar.bz2 (4.4MB)
100% |????????????????????????????????| 4.4MB 94kB/s
Collecting six>=1.5.2 (from scrapy)
Downloading six-1.9.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): zope.interface>=3.6.0 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from Twisted>=10.0.0->scrapy)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from zope.interface>=3.6.0->Twisted>=10.0.0->scrapy)
Installing collected packages: six, w3lib, lxml, Twisted, 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-7.1.0-py2.7.egg/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/commands/install.py", line 299, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_install.py", line 726, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_uninstall.py", line 125, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/utils/__init__.py", line 314, 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: '/tmp/pip-nIfswi-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
Run Code Online (Sandbox Code Playgroud)
小智 399
pip install --ignore-installed six
Run Code Online (Sandbox Code Playgroud)
会做的伎俩.
资料来源:github.com/pypa/pip/issues/3165
Mar*_*rio 151
我也认为绝对没有必要开始攻击OS X.
我能够解决这个问题
brew install python
Run Code Online (Sandbox Code Playgroud)
似乎使用新El Capitan附带的python/pip存在一些问题.
die*_*con 89
正如其他答案所说,这是因为新的系统完整性保护,但我相信其他答案过于复杂.
如果你只是在当前用户中使用该软件包,那么你应该可以通过使用--user标志来安装它,而无需禁用SIP .像这样:
sudo pip install --user packagename
Run Code Online (Sandbox Code Playgroud)
LYu*_*LYu 40
高投票的答案对我不起作用,似乎适用于El Capitan用户.但对于MacOS Sierra用户,请尝试以下步骤
brew install pythonsudo pip install --user <package name>rho*_*mes 23
警告
我强烈建议不要在Mac上修改Python系统; 有很多问题可以发生.
您的特定错误表明安装程序在解决Scrapy的依赖关系时遇到问题,而不会影响当前的Python安装.该系统使用Python执行许多基本任务,因此保持系统安装稳定并且最初由Apple 安装是很重要的.
在绕过内置安全性之前,我还会耗尽所有其他可能性.
包经理解决方案:
请先查看一下Python虚拟化工具,例如virtualenv ; 这将允许您安全地进行实验.
另一个使用语言和软件而不与Mac OS冲突的有用工具是Homebrew.与MacPorts或Fink一样,Homebrew是Mac的软件包管理器,对于安全地尝试许多其他语言和工具非常有用.
"推出自己的"软件安装:
如果您不喜欢包管理器方法,则可以使用该/usr/local路径或创建一个/opt/local目录来安装备用Python安装并修复您的路径.bashrc.请注意,您必须为这些解决方案启用root.
怎么办呢:
如果你绝对必须禁用安全检查(我真诚地希望它不是用于搞乱系统语言和资源),你可以暂时禁用它并使用本文中关于如何禁用系统的一些技术重新启用它诚信保护.
Rog*_*ger 16
这对我有用:
sudo pip install scrapy --ignore-installed six
Run Code Online (Sandbox Code Playgroud)
Erg*_*urt 12
您应该禁用"系统完整性保护",这是El Capitan的新功能.
首先,您应该在终端上运行无根配置命令
# nvram boot-args="rootless=0"
# reboot
Run Code Online (Sandbox Code Playgroud)
然后,您应该在恢复分区的终端(恢复操作系统)上运行以下命令
# csrutil disable
# reboot
Run Code Online (Sandbox Code Playgroud)
我刚刚解决了我的问题.我不确定第一部分是否必要.试试你喜欢的.
- 警告
一切正常后你应该再次启用SIP;
只需重新启动进入恢复模式并在终端中运行
# csrutil enable
Run Code Online (Sandbox Code Playgroud)
csrutil:配置系统完整性保护
Eve*_*nce 12
我尝试通过El Capitan中的pip安装AWS,但出现此错误
OSError:[Errno 1]不允许操作:'/ var/folders/wm/jhnj0g_s16gb36y8kwvrgm7h0000gp/T/pip-wTnb_D-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six- 1.4.1-py2.7.egg-INFO"
我在这里找到了答案
sudo -H pip install awscli --upgrade --ignore-installed six
Run Code Online (Sandbox Code Playgroud)
这个对我有用 :)
ski*_*r21 10
我在MacOS Sierra上遇到了同样的错误.我按照这些步骤成功安装了scarpy包.
1. sudo pip install --ignore-installed six
2. sudo pip install --ignore-installed scrapy
MacBook-Air:~ shree$ scrapy version
Scrapy 1.4.0
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
195748 次 |
| 最近记录: |