OSError: [Errno 1] Operation not permitted

安装scikit-image遇到的错误

操作系统Mac os 10.12,python2.7,用pip安装scikit-image:

sudo pip install scikit-image

结果出现这个错误:

Password:
The directory '/Users/baiyu/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/baiyu/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 scikit-image
  Downloading scikit_image-0.12.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 (22.2MB)
    100% |████████████████████████████████| 22.2MB 31kB/s 
Requirement already satisfied: networkx>=1.8 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from scikit-image)
Collecting six>=1.7.3 (from scikit-image)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting pillow>=2.1.0 (from scikit-image)
  Downloading Pillow-4.0.0-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 (3.4MB)
    100% |████████████████████████████████| 3.4MB 80kB/s 
Collecting dask[array]>=0.5.0 (from scikit-image)
  Downloading dask-0.13.0-py2.py3-none-any.whl (428kB)
    100% |████████████████████████████████| 430kB 175kB/s 
Requirement already satisfied: decorator>=3.4.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from networkx>=1.8->scikit-image)
Collecting olefile (from pillow>=2.1.0->scikit-image)
Requirement already satisfied: numpy; extra == "array" in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from dask[array]>=0.5.0->scikit-image)
Collecting toolz>=0.7.2; extra == "array" (from dask[array]>=0.5.0->scikit-image)
Installing collected packages: six, olefile, pillow, toolz, dask, scikit-image
  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/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
    copy2(src, real_dst)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
    copystat(src, dst)
  File "/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-TnNzkf-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

之后在网上搜了搜,发现很多人遇到这个错误,是six1.4.1这个模块安装时出现错误,解决办法是:

sudo pip install scikit-image  --upgrade --ignore-installed six

结果为:

Password:
The directory '/Users/baiyu/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/baiyu/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 scikit-image
  Downloading scikit_image-0.12.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 (22.2MB)
    100% |████████████████████████████████| 22.2MB 21kB/s 
Collecting six
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting networkx>=1.8 (from scikit-image)
  Downloading networkx-1.11-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 39kB/s 
Collecting pillow>=2.1.0 (from scikit-image)
  Downloading Pillow-4.0.0-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 (3.4MB)
    100% |████████████████████████████████| 3.4MB 51kB/s 
Collecting dask[array]>=0.5.0 (from scikit-image)
  Downloading dask-0.13.0-py2.py3-none-any.whl (428kB)
    100% |████████████████████████████████| 430kB 115kB/s 
Collecting decorator>=3.4.0 (from networkx>=1.8->scikit-image)
  Downloading decorator-4.0.11-py2.py3-none-any.whl
Collecting olefile (from pillow>=2.1.0->scikit-image)
Collecting numpy; extra == "array" (from dask[array]>=0.5.0->scikit-image)
  Downloading numpy-1.12.0-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.4MB)
    100% |████████████████████████████████| 4.4MB 84kB/s 
Collecting toolz>=0.7.2; extra == "array" (from dask[array]>=0.5.0->scikit-image)
Installing collected packages: decorator, networkx, six, olefile, pillow, numpy, toolz, dask, scikit-image
Successfully installed dask-0.13.0 decorator-4.0.11 networkx-1.11 numpy-1.12.0 olefile-0.44 pillow-4.0.0 scikit-image-0.12.3 six-1.10.0 toolz-0.8.2

总结:以后用pip安装模块的时候,可以用–ignoring-installed * 选项来屏蔽已经安装过的模块。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值