Mac OS X pip 安装package时问题
2016-01-26 13:59
676 查看
作者使用pip安装openstack client时,遇到如下问题,这些问题在安装其他package时也可能遇到:
1. Permission denied: '/Library/Python/2.7/site-packages/pbr
需要sudo安装,且sudo -H, eg. sudo -H pip install xx
2. download package后,自动卸载six时出错
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-8.0.2-py2.7.egg/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_set.py", line 725, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_install.py", line 752, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/utils/__init__.py", line 266, 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-E_Jrbs-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
MAC OS X EI Capitan 自带six 的1.4.1, 当卸载时没有权限,System Integrity Protection 不允许包括root在内的用户修改改目录。
所以在命令中加入
--upgrade --ignore-installed six
3. 最终运行命令:
sudo -H pip install xxx --upgrade --ignore-installed six
eg.
PS: 此问题发生在使用MAC自带python情况下,安装目录默认在系统目录。
使用系统自带python 开发可能后期会遇到各种问题,解决起来很麻烦。
建议开发者自己安装python,就不会遇到上述问题。
1. Permission denied: '/Library/Python/2.7/site-packages/pbr
需要sudo安装,且sudo -H, eg. sudo -H pip install xx
2. download package后,自动卸载six时出错
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-8.0.2-py2.7.egg/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_set.py", line 725, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_install.py", line 752, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-8.0.2-py2.7.egg/pip/utils/__init__.py", line 266, 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-E_Jrbs-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
MAC OS X EI Capitan 自带six 的1.4.1, 当卸载时没有权限,System Integrity Protection 不允许包括root在内的用户修改改目录。
所以在命令中加入
--upgrade --ignore-installed six
3. 最终运行命令:
sudo -H pip install xxx --upgrade --ignore-installed six
eg.
PS: 此问题发生在使用MAC自带python情况下,安装目录默认在系统目录。
使用系统自带python 开发可能后期会遇到各种问题,解决起来很麻烦。
建议开发者自己安装python,就不会遇到上述问题。
相关文章推荐
- Linux串口编程一次读取全部输入的数据(输入数据不定长)
- Java关键字transient
- struts1+jdbc增删改查
- TextView设置内容setText设置不成功
- How to use STA(sql tuning advisor)
- Reverse Words in a String -- LeetCode
- 定时器传参数
- Vim实战指南(一):基础编辑命令
- 利用Android Studio搜索在程序中的硬编码字符串(String)
- 【百金轻】:系好安全带 波动性加剧
- extjs getel 怎么用
- android系统媒体库开发之音乐
- 如何让一个点绕中心旋转
- Python模块安装: pip常见的使用方法
- lintcode:Search for a Range
- 133 php Streams(流)介绍及使用
- window system doesn't support opengl (raspberry pi)
- 在小米路由器mini上安装Transmission挂BT/PT
- 航电Problem-1008 Elevator
- 在WebView中如何让JS与Java安全地互相调用