OSError: [Errno 1] Operation not permitted

来源:互联网 发布:上海it helpdesk招聘 编辑:程序博客网 时间:2024/04/30 08:28

安装scikit-image遇到的错误

操作系统Mac os 10.12,python2.7,用pip安装scikit-image:

sudo pip install scikit-image

结果出现这个错误:

Password:The directory '/Users/baiyu/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.The directory '/Users/baiyu/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.Collecting scikit-image  Downloading scikit_image-0.12.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 (22.2MB)    100% |████████████████████████████████| 22.2MB 31kB/s Requirement already satisfied: networkx>=1.8 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from scikit-image)Collecting six>=1.7.3 (from scikit-image)  Downloading six-1.10.0-py2.py3-none-any.whlCollecting pillow>=2.1.0 (from scikit-image)  Downloading Pillow-4.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 (3.4MB)    100% |████████████████████████████████| 3.4MB 80kB/s Collecting dask[array]>=0.5.0 (from scikit-image)  Downloading dask-0.13.0-py2.py3-none-any.whl (428kB)    100% |████████████████████████████████| 430kB 175kB/s Requirement already satisfied: decorator>=3.4.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from networkx>=1.8->scikit-image)Collecting olefile (from pillow>=2.1.0->scikit-image)Requirement already satisfied: numpy; extra == "array" in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from dask[array]>=0.5.0->scikit-image)Collecting toolz>=0.7.2; extra == "array" (from dask[array]>=0.5.0->scikit-image)Installing collected packages: six, olefile, pillow, toolz, dask, scikit-image  Found existing installation: six 1.4.1    DEPRECATION: Uninstalling a distutils installed project (six) 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 six-1.4.1:Exception:Traceback (most recent call last):  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main    status = self.run(options, args)  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run    prefix=options.prefix_path,  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 778, in install    requirement.uninstall(auto_confirm=True)  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_install.py", line 754, in uninstall    paths_to_remove.remove(auto_confirm)  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove    renames(path, new_path)  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames    shutil.move(old, new)  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move    copy2(src, real_dst)  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2    copystat(src, dst)  File "/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-TnNzkf-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

之后在网上搜了搜,发现很多人遇到这个错误,是six1.4.1这个模块安装时出现错误,解决办法是:

sudo pip install scikit-image  --upgrade --ignore-installed six

结果为:

Password:The directory '/Users/baiyu/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.The directory '/Users/baiyu/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.Collecting scikit-image  Downloading scikit_image-0.12.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 (22.2MB)    100% |████████████████████████████████| 22.2MB 21kB/s Collecting six  Downloading six-1.10.0-py2.py3-none-any.whlCollecting networkx>=1.8 (from scikit-image)  Downloading networkx-1.11-py2.py3-none-any.whl (1.3MB)    100% |████████████████████████████████| 1.3MB 39kB/s Collecting pillow>=2.1.0 (from scikit-image)  Downloading Pillow-4.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 (3.4MB)    100% |████████████████████████████████| 3.4MB 51kB/s Collecting dask[array]>=0.5.0 (from scikit-image)  Downloading dask-0.13.0-py2.py3-none-any.whl (428kB)    100% |████████████████████████████████| 430kB 115kB/s Collecting decorator>=3.4.0 (from networkx>=1.8->scikit-image)  Downloading decorator-4.0.11-py2.py3-none-any.whlCollecting olefile (from pillow>=2.1.0->scikit-image)Collecting numpy; extra == "array" (from dask[array]>=0.5.0->scikit-image)  Downloading numpy-1.12.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 (4.4MB)    100% |████████████████████████████████| 4.4MB 84kB/s Collecting toolz>=0.7.2; extra == "array" (from dask[array]>=0.5.0->scikit-image)Installing collected packages: decorator, networkx, six, olefile, pillow, numpy, toolz, dask, scikit-imageSuccessfully installed dask-0.13.0 decorator-4.0.11 networkx-1.11 numpy-1.12.0 olefile-0.44 pillow-4.0.0 scikit-image-0.12.3 six-1.10.0 toolz-0.8.2

总结:以后用pip安装模块的时候,可以用–ignoring-installed * 选项来屏蔽已经安装过的模块。

0 0
原创粉丝点击