Could not install packages due to an EnvironmentError: pip install 安装时遇到环境错误的解决办法

12 篇文章 0 订阅
5 篇文章 0 订阅

具体报错

 Found existing installation: setuptools 18.5
    Uninstalling setuptools-18.5:
Could not install packages due to an EnvironmentError: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/private/var/folders/st/r_c40wz94cnf4c426r0lvp600000gn/T/pip-uninstall-b9GLPD/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/private/var/folders/st/r_c40wz94cnf4c426r0lvp600000gn/T/pip-uninstall-b9GLPD/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/__init__.py', '/private/var/folders/st/r_c40wz94cnf4c426r0lvp600000gn/T/pip-uninstall-b9GLPD/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/private/var/folders/st/r_c40wz94cnf4c426r0lvp600000gn/T/pip-uninstall-b9GLPD/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/markers.py', '/private/var/folders/st/r_c40wz94cnf4c426r0lvp600000gn/T/pip-uninstall-b9GLPD/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/private/var/folders/st/r_c40wz94cnf4c426r0lvp600000gn/T/pip-uninstall-b9GLPD/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/__init__.pyc', '/private/var/folders/st/r_c40wz94cnf4c426r0lvp600000gn/T/pip-uninstall-b9GLPD/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/private/var/folders/st/r_c40wz94cnf4c426r0lvp600000gn/T/pip-uninstall-b9GLPD/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', '/private/var/folders/st/r_c40wz94cnf4c426r0lvp600000gn/T/pip-uninstall-b9GLPD/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/private/var/folders/st/r_c40wz94cnf4c426r0lvp600000gn/T/pip-uninstall-b9GLPD/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]

我是在安装python27对应版本的tensorflow时候遇到报错。

原因是无权限写入,原命令为:

 pip2 install tensorflow

解决方法有三种:

1.启动一个虚拟环境来安装

python2 -m venv env
source ./env/bin/activate 
python -m pip install tensorflow

2.安装到user文件夹中

python2 -m pip install --user tensorflow

 

3.安装到系统文件夹中

sudo python2 -m pip install tensorflow

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值