解决mac osx下pip安装ipython权限的问题
2016-09-27 00:29
375 查看
这两天又把家里的mac的系统给重装了,重装的原因是我乐意… 其实理由很简单,本人想写个mac osx系统的使用文档,当然是初级的那种… 这尼玛还没意气风发就狼狈不堪了…
该文章写的有些乱,欢迎来喷 ! 另外文章后续不断更新中,请到原文地址查看更新。
http://xiaorui.cc/?p=3061
各种的新mac其我也用过不少,自己或帮助别人配置了不少环境… 今天就遇到一个十分纠结的问题.
就是想装个python的交互组件ipython、gevent而已….
Python
下面是pip install gevent的错误提示, 又是 Operation not permitted …Python
其实权限问题… OSError: [Errno 1] Operation not permitted , 各种的root都不可以,想到了一个粗暴的方式,直接针对share进行chmod的授权。 结果… 提示root也是没有权限操作系统的目录。 我突然发觉肯定是新版的osx有了某种机制制止我们直接的修改/System文档数据。
google了后,发现果然如我的所料…. 新系统有个叫sip的机制。 你暂时不能直接在终端进行 csrutil disable 会出现错误提示,引导你去mac osx的恢复模式进行操作。
由于El Capitan引入了SIP机制(System Integrity Protection),默认下系统启用SIP系统完整性保护机制,无论是对于硬盘还是运行时的进程限制对系统目录的写操作。 这也是我们安装ipython失败的原因….
现在的解决办法是取消SIP机制,具体做法是:
重启电脑,按住Command+R(直到出现苹果标志)进入Recovery Mode(恢复模式)
左上角菜单里找到实用工具 -> 终端
输入csrutil disable回车
重启Mac即可
如果想重新启动SIP机制重复上述步骤改用csrutil enable即可
我们现在再看看sip的状态, 这样再安装ipython、gevent再也不会提示无法写入的权限提示了/
Python
如果在mac下碰到OSError: [Errno 1] Operation not permitted:的问题,就算用sudo 也无法解决,那肯定是sip在作怪了.
胡阳大哥给出一个优雅的方案,大家可以使用下. 基于用户的权限来安装模块包显得更加合理。
pip install ipython --user -U
该文章写的有些乱,欢迎来喷 ! 另外文章后续不断更新中,请到原文地址查看更新。
http://xiaorui.cc/?p=3061
各种的新mac其我也用过不少,自己或帮助别人配置了不少环境… 今天就遇到一个十分纠结的问题.
就是想装个python的交互组件ipython、gevent而已….
Python
1234567891011121314151617181920212223242526272829 | #xiaorui.ccsudo pip install --upgrade ipython --ignore-installed six Exception:Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 209, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run prefix=options.prefix_path, File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 732, in install **kwargs File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 835, in install self.move_wheel_files(self.source_dir, root=root, prefix=prefix) File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 1030, in move_wheel_files isolated=self.isolated, File "/Library/Python/2.7/site-packages/pip/wheel.py", line 376, in move_wheel_files clobber(source, dest, False, fixer=fixer, filter=filter) File "/Library/Python/2.7/site-packages/pip/wheel.py", line 315, in clobber ensure_dir(destdir) File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir os.makedirs(path) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode)OSError: [Errno 1] Operation not permitted: '/System/Library/Frameworks/Python.framework/Versions/2.7/share' |
1 2 3 4 5 6 | #xiaorui.cc pipinstallgevent ... raiseError,errors Error:[('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py','/tmp/pip-jlyjj9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py',"[Errno 1] Operation not permitted: '/tmp/pip-jlyjj9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"),('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc','/tmp/pip-jlyjj9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc',"[Errno 1] Operation not permitted: '/tmp/pip-jlyjj9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"),('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py','/tmp/pip-jlyjj9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py',"[Errno 1] Operation not permitted: '/tmp/pip-jlyjj9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"),('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc','/tmp/pip-jlyjj9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc',"[Errno 1] Operation not permitted: '/tmp/pip-jlyjj9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"),('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib','/tmp/pip-jlyjj9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib',"[Errno 1] Operation not permitted: '/tmp/pip-jlyjj9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")] |
google了后,发现果然如我的所料…. 新系统有个叫sip的机制。 你暂时不能直接在终端进行 csrutil disable 会出现错误提示,引导你去mac osx的恢复模式进行操作。
由于El Capitan引入了SIP机制(System Integrity Protection),默认下系统启用SIP系统完整性保护机制,无论是对于硬盘还是运行时的进程限制对系统目录的写操作。 这也是我们安装ipython失败的原因….
现在的解决办法是取消SIP机制,具体做法是:
重启电脑,按住Command+R(直到出现苹果标志)进入Recovery Mode(恢复模式)
左上角菜单里找到实用工具 -> 终端
输入csrutil disable回车
重启Mac即可
如果想重新启动SIP机制重复上述步骤改用csrutil enable即可
我们现在再看看sip的状态, 这样再安装ipython、gevent再也不会提示无法写入的权限提示了/
Python
1 2 3 | $ csrutil status System Integrity Protection status: disabled. |
胡阳大哥给出一个优雅的方案,大家可以使用下. 基于用户的权限来安装模块包显得更加合理。
pip install ipython --user -U
相关文章推荐
- 【理论】python使用celery异步处理请求
- Python--第4天 一大波金融Library来袭之scipy篇
- 【Python开发】python读写文件,和设置文件的字符编码比如utf-8
- 利用python发送和接收邮件
- python搭建虚拟环境的步骤详解
- 20招让你的Python飞起来!
- python 采集中文乱码问题的完美解决方法
- ipython笔记
- Python中的startswith和endswith函数使用实例
- python标准模块subprocess
- python笔记
- Python 前端之CSS
- Python学习笔记——迭代器(RandSeq和AnyIter)
- python标准模块学习11_______hmac模块
- Web漏洞扫描工具-python
- Python的with用法理解
- python标准模块学习10_______sha模块
- com_error: (-2147221008, '\xc9\xd0\xce\xb4\xb5\xf7\xd3\xc3 CoInitialize\xa1\
- python标准模块学习9_______md5模块
- 习题10--转义字符