Python Mac:OSError:[Errno 1]不允许操作:'/tmp/pip-XcfgD6

Python Mac:OSError:[Errno 1]不允许操作:'/tmp/pip-XcfgD6,python,tensorflow,sip,Python,Tensorflow,Sip,当我在Mac OS中使用tensorflow时,出现了以下错误: Installing collected packages: html5lib, bleach, markdown, backports.weakref, numpy, funcsigs, pbr, mock, protobuf, tensorflow Found existing installation: numpy 1.8.0rc1 DEPRECATION: Uninstalling a distutils in

当我在Mac OS中使用tensorflow时,出现了以下错误:

Installing collected packages: html5lib, bleach, markdown, backports.weakref, numpy, funcsigs, pbr, mock, protobuf, tensorflow
  Found existing installation: numpy 1.8.0rc1
    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.
    Uninstalling numpy-1.8.0rc1:
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: '/var/folders/nl/69lb138j255bkbzzjdx1hb6h0000gp/T/pip-1Jo9RF-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'

这是什么意思?如何修复它?

将参数
--ignore installed
添加到正在运行的pip命令中。看。

在谷歌搜索之后,我发现这是由mac OS的SIP机器引起的

因此,我使用以下命令再次运行pip:

pip install tensorflow --user -U
我终于成功地安装了tensorflow

pip install tensorflow --user -U

如果您没有管理员权限,它会确保您只为您的用户安装库。

@MichaelL。不应该这样。除非您修改了使用pip命令安装的任何先前安装的模块。