首页 文章

在mac中安装opencv-python时,OSError:[Errno 1]不允许操作

提问于
浏览
1

$ pip install opencv-python

收集opencv-python使用缓存的opencv_python-3.2.0.7-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收集numpy> = 1.11.1(来自opencv-python)使用缓存的numpy-1.13.1-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安装收集的软件包:numpy,opencv-python发现现有安装:numpy 1.8.0rc1弃用:已弃用安装了distutils的项目(numpy),将来将被删除版 . 这是因为卸载distutils项目只会部分卸载项目 . 卸载numpy-1.8.0rc1:异常:Traceback(最近一次调用最后一次):文件"/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py",第215行,主状态= self.run(options,args)文件"/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py",第342行,运行前缀= options.prefix_path,文件"/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py",第778行,在安装要求.uninstall(auto_confirm = True)文件"/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py",第754行,在卸载paths_to_remove.remove(auto_confirm)文件"/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py",第115行,删除重命名(path,new_path)文件“/ 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 “,第103行,在copystat os.chflags(dst,st.st_flags) OSError: [Errno 1] Operation not permitted: '/var/folders/dd/70hgtbs50hl5sr13h93gzzm80000gn/T/pip-BDWfhx-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'

当我尝试使用sudo时,

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

我试图卸载numpy . 但仍然发生权限错误.. OSError: [Errno 1] Operation not permitted: '/var/folders/dd/70hgtbs50hl5sr13h93gzzm80000gn/T/pip-yKfQhH-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'

与sudo, OSError: [Errno 1] Operation not permitted: '/tmp/pip-sIVZu9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info' The directory '/Users/jack/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.

最后,我尝试通过pip uninstall python卸载python但是有, OSError: [Errno 1] Operation not permitted: '/var/folders/dd/70hgtbs50hl5sr13h93gzzm80000gn/T/pip-7ByYw9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/Python-2.7.10-py2.7.egg-info'

和sudo, OSError: [Errno 1] Operation not permitted: '/tmp/pip-1UeP4t-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/Python-2.7.10-py2.7.egg-info' The directory '/Users/jack/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.

所以..我也递归删除目录 . sudo rm -rf / tmp / pip-1UeP4t-uninstall /

但那些目录正确地重现了它 .

3 回答

  • 0

    使用sudo -H标志和/或使用ignore-installed标志: sudo -H pip install --ignore-installed opencv-python

  • 0

    sudo -H pip install --ignore-installed opencv-python

    这对我有用

  • 0

    试试这个 pip install --user opencv-python . 这应该有助于将 setup.py 传递给用户 . 你不需要 virtualenv .

相关问题