mac下用pip 安装软件出现错误Operation not permitted

15 篇文章 0 订阅
2 篇文章 0 订阅

在mac上用pip 安装keras时出现 如下错误:

➜  ~ sudo pip install keras
The directory '/Users/zhangxin/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/zhangxin/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting keras
  Downloading Keras-2.0.8-py2.py3-none-any.whl (276kB)
    100% |████████████████████████████████| 276kB 465kB/s 
Requirement already satisfied: pyyaml in /Library/Python/2.7/site-packages (from keras)
Collecting six>=1.9.0 (from keras)
  Downloading six-1.11.0-py2.py3-none-any.whl
Collecting scipy>=0.14 (from keras)
  Downloading scipy-0.19.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (16.2MB)
    100% |████████████████████████████████| 16.2MB 66kB/s 
Collecting numpy>=1.9.1 (from keras)
  Downloading numpy-1.13.3-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (4.6MB)
    100% |████████████████████████████████| 4.6MB 189kB/s 
Installing collected packages: six, numpy, scipy, keras
  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-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/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: '/tmp/pip-UxHbJe-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

解决方法:

# 基于用户的权限来安装模块包。
pip install keras --user -U
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
出现"ERROR: Could not find a version that satisfies the requirement"错误时,可能是由于以下几个原因导致的: 1. 源不可用:清华源可能没有所需的软件包版本。你可以尝试切换到其他可用的源,如官方源或其他第三方源。 2. 版本不匹配:你可能在安装软件包时指定了一个不存在或不兼容的版本。你可以尝试使用其他版本或者不指定版本来安装。 3. 网络问题:你的网络连接可能不稳定或者被防火墙阻止了。你可以尝试使用其他网络或者关闭防火墙来解决问题。 解决这个错误的方法有以下几种: 1. 切换源:可以尝试切换到其他可用的源,如官方源或其他第三方源。可以使用以下命令切换源: ```shell pip install -i https://pypi.python.org/simple/ package_name ``` 2. 不指定版本:可以尝试不指定版本来安装软件包,让pip自动选择最新的版本进行安装。可以使用以下命令来安装软件包: ```shell pip install package_name ``` 3. 使用特定版本:如果你需要安装特定版本的软件包,可以尝试使用其他版本号进行安装。可以使用以下命令来安装指定版本的软件包: ```shell pip install package_name==version_number ``` 4. 检查网络连接:确保你的网络连接正常,并且没有被防火墙阻止。可以尝试使用其他网络或者关闭防火墙来解决问题。 5. 更新pip:确保你的pip版本是最新的。可以使用以下命令来更新pip: ```shell pip install --upgrade pip ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

张欣-男

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值