Tag Archives: OSError: [Errno 1] Operation not permitted

[Solved] Python pip install Error: OSError: [Errno 1] Operation not permitted

Solutions

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

If it can’t be solved

1. Restart the computer, press Command + R to enter recovery mode, click menu utility, open terminal, and enter CSR util disable

2. Restart the computer, enter normally, open [terminal] and input csrutil status

This is MacOSX 10.11 EI capital using rootlets, which can be understood as a higher level of kernel protection. The system will lock/system,/SBIN,/usr by default

This protection can be turned off by the above method

If it is not closed, it will appear when some software is installed

Operation not permitted

Solution for oserror: [errno 1] operation not permitted encountered when installing tensorflow

Knowledge map advanced must read: read how large-scale map data efficient storage and retrieval>>>

Installing collected packages: numpy, scipy, six, pyyaml, Keras, opencv-python, h5py, html5lib, bleach, futures, wheel, werkzeug, markdown, protobuf, tensorflow-tensorboard, pbr, funcsigs, mock, backports.weakref, tensorflow
  Found existing installation: numpy 1.14.1
    Uninstalling numpy-1.14.1:
      Successfully uninstalled numpy-1.14.1
  Found existing installation: scipy 0.13.0b1
    DEPRECATION: Uninstalling a distutils installed project (scipy) 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 scipy-0.13.0b1:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/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-k6sIvY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy-0.13.0b1-py2.7.egg-info'

  

First of all, I think of the problem of directory permissions, so I don’t know how many times’ Chmod 755 ‘has been implemented, and it doesn’t work

Is that because there is something wrong with the ownership of the directory?It’s a new way to modify the “chown usename” and it’s still useless

Finally, we had to Google and found this article: https://www.jianshu.com/p/7a18c78b5982 Yes, he solved my problem. He just needs a little upgrade to the old package. Here is a record of the executed commands as follows:

$ 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