美文网首页python学习笔记Python程序员联盟
解决 mac OSX pip OSError: [Errno 1

解决 mac OSX pip OSError: [Errno 1

作者: phantomvk | 来源:发表于2016-11-24 23:02 被阅读7435次

这段时间在弄机器学习的事情,然后看Macbook里面的Python库有点旧,就用pip更新一下。

$ pip install --upgrade numpy

结果抛出下面这个异常报告

Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/basecommand.py", line 223, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/commands/install.py", line 299, in run
    root=options.root_path,
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 640, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_install.py", line 726, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_uninstall.py", line 125, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/utils/__init__.py", line 314, 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-1_nHcH-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'

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

相关文章

网友评论

  • 11857bd4dbd6:解决了,谢谢。
  • shensir_aye:你好 , 我最近也在看机器学习,但是TensorFlow不会安装 可以教教我吗
    phantomvk:@shensir_aye 抱歉,由于岗位不是机器学习,所以最近落下了很多。我还没有用过TensorFlow,2018年应该会涉足这个部分。网上的教程也比较多,也比较完善,建议网上多看几篇相关文章。
  • 寻水的鱼096:倒数第二行代码有问题哦
    phantomvk:修正了,谢谢

本文标题:解决 mac OSX pip OSError: [Errno 1

本文链接:https://www.haomeiwen.com/subject/swdipttx.html