(1) 写在前面

在安装机器学习python包时,提示Macbook里面的Python库有点旧,就用pip更新一下。

$ sudo pip install pandas

$ pip install --upgrade numpy

在安装过程中出现了如下错误:

OSError: [Errno 1] Operation not permitted: '/var/folders/bm/dccwv2v97y75hdshqnh1bbpr0000gn/T/pip-_dyADZ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'

(2) 具体错误报告如下:

  1. localhost:Applications a6$ sudo pip install pandas

  2. The directory '/Users/a6/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.

  3. The directory '/Users/a6/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.

  4. Collecting pandas

  5. Downloading pandas-0.21.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 (16.7MB)

  6. 100% |████████████████████████████████| 16.7MB 48kB/s

  7. Requirement already satisfied: pytz>=2011k in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pandas)

  8. Requirement already satisfied: python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pandas)

  9. Collecting numpy>=1.9.0 (from pandas)

  10. 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)

  11. 100% |████████████████████████████████| 4.6MB 6.4kB/s

  12. Installing collected packages: numpy, pandas

  13. Found existing installation: numpy 1.8.0rc1

  14. DEPRECATION: Uninstalling a distutils installed project (numpy) 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.

  15. Uninstalling numpy-1.8.0rc1:

  16. Exception:

  17. Traceback (most recent call last):

  18. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main

  19. status = self.run(options, args)

  20. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run

  21. prefix=options.prefix_path,

  22. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install

  23. requirement.uninstall(auto_confirm=True)

  24. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall

  25. paths_to_remove.remove(auto_confirm)

  26. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove

  27. renames(path, new_path)

  28. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames

  29. shutil.move(old, new)

  30. File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move

  31. copy2(src, real_dst)

  32. File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2

  33. copystat(src, dst)

  34. File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat

  35. os.chflags(dst, st.st_flags)

  36. OSError: [Errno 1] Operation not permitted: '/tmp/pip-jPsGEm-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'

  1. localhost:Applications a6$ pip install -U numpy

  2. Collecting numpy

  3. Using cached 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. Installing collected packages: numpy

  5. Found existing installation: numpy 1.8.0rc1

  6. DEPRECATION: Uninstalling a distutils installed project (numpy) 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.

  7. Uninstalling numpy-1.8.0rc1:

  8. Exception:

  9. Traceback (most recent call last):

  10. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main

  11. status = self.run(options, args)

  12. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run

  13. prefix=options.prefix_path,

  14. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install

  15. requirement.uninstall(auto_confirm=True)

  16. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall

  17. paths_to_remove.remove(auto_confirm)

  18. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove

  19. renames(path, new_path)

  20. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames

  21. shutil.move(old, new)

  22. File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move

  23. copy2(src, real_dst)

  24. File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2

  25. copystat(src, dst)

  26. File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat

  27. os.chflags(dst, st.st_flags)

  28. OSError: [Errno 1] Operation not permitted: '/var/folders/bm/dccwv2v97y75hdshqnh1bbpr0000gn/T/pip-_dyADZ-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'

  1. localhost:Applications a6$ sudo pip install -U numpy

  2. The directory '/Users/a6/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.

  3. The directory '/Users/a6/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.

  4. Collecting numpy

  5. 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)

  6. 100% |████████████████████████████████| 4.6MB 198kB/s

  7. Installing collected packages: numpy

  8. Found existing installation: numpy 1.8.0rc1

  9. DEPRECATION: Uninstalling a distutils installed project (numpy) 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.

  10. Uninstalling numpy-1.8.0rc1:

  11. Exception:

  12. Traceback (most recent call last):

  13. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main

  14. status = self.run(options, args)

  15. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run

  16. prefix=options.prefix_path,

  17. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install

  18. requirement.uninstall(auto_confirm=True)

  19. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall

  20. paths_to_remove.remove(auto_confirm)

  21. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove

  22. renames(path, new_path)

  23. File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames

  24. shutil.move(old, new)

  25. File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move

  26. copy2(src, real_dst)

  27. File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2

  28. copystat(src, dst)

  29. File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat

  30. os.chflags(dst, st.st_flags)

  31. OSError: [Errno 1] Operation not permitted: '/tmp/pip-QissHG-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'

(3) 解决办法

1) 一番百度,Google后找到这个解决方案:

$ pip install --upgrade pip
$ sudo pip install numpy --upgrade --ignore-installed
$ sudo pip install scipy --upgrade --ignore-installed
$ sudo pip install scikit-learn --upgrade --ignore-installed
$ sudo pip install scipy --upgrade --ignore-installed

2) 具体代码如下:

  1. localhost:Applications a6$ sudo pip install scipy --upgrade --ignore-installed

  2. The directory '/Users/a6/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.

  3. The directory '/Users/a6/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.

  4. Collecting scipy

  5. Downloading scipy-1.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 (16.8MB)

  6. 100% |████████████████████████████████| 16.8MB 41kB/s

  7. Collecting numpy>=1.8.2 (from scipy)

  8. 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)

  9. 100% |████████████████████████████████| 4.6MB 89kB/s

  10. Installing collected packages: numpy, scipy

  11. Successfully installed numpy-1.13.3 scipy-1.0.0

  12. localhost:Applications a6$ pip install --upgrade pip

  13. Requirement already up-to-date: pip in /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg

  14. localhost:Applications a6$ sudo pip install -U numpy

  15. The directory '/Users/a6/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.

  16. The directory '/Users/a6/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.

  17. Requirement already up-to-date: numpy in /Library/Python/2.7/site-packages

  1. localhost:Applications a6$ sudo pip install pandas

  2. The directory '/Users/a6/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.

  3. The directory '/Users/a6/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.

  4. Collecting pandas

  5. Downloading pandas-0.21.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 (16.7MB)

  6. 100% |████████████████████████████████| 16.7MB 54kB/s

  7. Requirement already satisfied: pytz>=2011k in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pandas)

  8. Requirement already satisfied: python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pandas)

  9. Requirement already satisfied: numpy>=1.9.0 in /Library/Python/2.7/site-packages (from pandas)

  10. Installing collected packages: pandas

  11. Successfully installed pandas-0.21.0

  12. localhost:Applications a6$

解决 mac安装或者更新第三方包安装不上的问题 mac OSX pip OSError: [Errno 1] Operation not permitted相关推荐

  1. python第三方包是什么意思_安装Python和第三方包的方法

    应女朋友的邀请,写一篇关于Python和第三方包的安装方法. 一.Python安装 上官网Welcome to Python.org​www.python.org 下载保存 二.Pycharm安装 上 ...

  2. mac-python包安装错误 [Errno 1] Operation not permitted: '/var/folders/5n/vbm997m56xg3kw67y6bccn2m0000gn/T

    问题信息: [Errno 1] Operation not permitted: '/var/folders/5n/vbm997m56xg3kw67y6bccn2m0000gn/T/pip-4tcBs ...

  3. 安装没有在R包仓库CRAN上托管的R包

    安装没有在R包仓库CRAN上托管的R包 有的时候,我们有些任务需要使用新的R包.但是,一旦切换到本地环境并使用'install.packages()'命令获取包,可能会发现到无法在本地安装包.可能的原 ...

  4. Python--安装pyecharts包,anaconda环境下如何正确安装神奇可视化pyecharts包[安装的那些事儿]

    Python--安装pyecharts包,anaconda环境下如何正确安装神奇可视化pyecharts包[安装的那些事儿] 更多更多安装教程及软件获取请加关注留言哟~~,若需私信联系博主请加: 一. ...

  5. 源码包安装mysql_源码包安装MySQL

    MySQL安装方式 1.二进制安装2.源码包安装3.rpm包安装 一.源码包安装 源码包安装比较繁琐,但是更加灵活,可以按自己需求配置 1.下载源码包 [root@db03~]# wget https ...

  6. 安装Pod时提示ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/pod...

    环境:OSX EI 10.11.1 昨天切换gem源后,招待pod安装没有任何问题,也可以正常用$ gem sources --add https://ruby.taobao.org/ --remov ...

  7. 安装pod遇到这种错误ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/xco

    安装pod 遇到这种错误 ERROR:  While executing gem ... (Errno::EPERM)     Operation not permitted - /usr/bin/x ...

  8. go语言 第三方包安装方法_【分享吧】Go语言第三方包的使用介绍与场景应用

    Go语言是一种跨平台(Mac OS.Windows.Linux 等)的静态编译型语言.拥有媲美C语言的强大性能,支持静态类型安全,在普通计算机上能几秒内快速编译一个大项目,开发效率跟动态语言相差无几. ...

  9. python第三方包安装方法(两种方法)

    具体有以下两种方法: 第一种方法(不使用pip或者easy_install): Step1:在网上找到的需要的包,下载下来.eg. rsa-3.1.4.tar.gz Step2:解压缩该文件. Ste ...

最新文章

  1. Sangfor_AC用户不在线但在“在线用户管理”里有显示
  2. php+tcc,64位Linux环境安装PHP TCC扩展方法
  3. Ecplise软件Devices看到两个相同设备问题
  4. Linux环境手动创建oracle10g数据库实践
  5. [Hei.Captcha] Asp.Net Core 跨平台验证码实现
  6. webpack 保存文件后自动打包_继webpack后又一打包神器Parcel
  7. leetcode 241 python
  8. 随想录(从技术到业务的转变)
  9. 优化配置ISA2006淹没缓解
  10. 如何从git中移除一个子模块(submodule)
  11. Android 11.0 12.0关机界面全屏显示(UI全屏显示)
  12. 【Python+Appium】开展自动化测试(八)swipe()滑动页面
  13. N个空饮料瓶总共能换多少瓶饮料喝的问题
  14. Mybatis时区问题
  15. 沟通的艺术(笔记)——前言
  16. 20世纪最佳12部学术专著
  17. PXI/PXIe控制器 4Link架构 16GB带宽 兼容主流PXIe机箱 设计文件!!! 原理图PCB
  18. 2020 华数杯——脱贫帮扶绩效评价(Python代码实现)
  19. 影视网QQ群机器人接口对接 苹果CMS视频jiexi站
  20. mysql最近7天销售额_mysql查询近七天、近三十天、近年(按月份)的所有统计数据...

热门文章

  1. c++小游戏[2.0.1测试版本]和[2.2版本]
  2. 毕业设计 基于树莓派的智能家庭监控系统
  3. 5G(2)5G NR Redcap
  4. 通达OA短信平台,通达OA完美对接中国移动MAS短信平台
  5. Windows 无法验证此设备所需的驱动程序的数字签名
  6. 计算机网络的主要红木有,报关员第4章练习题2
  7. java经典50道编程题(很好练逻辑思维的题)(第四篇)
  8. .xlsx IE下不能导出下载
  9. 张长水:图像识别与机器学习
  10. 人脸年龄估计matlab,基于人脸的年龄识别系统设计与实现