博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
错误:OSError: [Errno 1] Operation not permitted: 'lib/python/six-1.4.1-py2.7.egg-info'
阅读量:6161 次
发布时间:2019-06-21

本文共 6354 字,大约阅读时间需要 21 分钟。

解决办法:

$ sudo chown -R $USER /usr/local/lib/python2.7$ pip install mock --ignore-installed six --user

 

 

问题:安装mock时报错:

(venv)➜  test git:(master) pip install mockRequirement already satisfied: mock in /Library/Python/2.7/site-packagesCollecting six>=1.9 (from mock)  Using cached six-1.11.0-py2.py3-none-any.whlRequirement already satisfied: funcsigs>=1; python_version < "3.3" in /Library/Python/2.7/site-packages (from mock)Requirement already satisfied: pbr>=0.11 in /Library/Python/2.7/site-packages (from mock)Installing collected packages: six  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/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: '/var/folders/pk/7yrbjrzx0j76mvd9s49djz_40000gn/T/pip-ogx4a9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

 

 

参考:

pip install --ignore-installed six

又报错:

(venv)➜  test git:(master) pip install mock --ignore-installed sixCollecting mock  Using cached mock-2.0.0-py2.py3-none-any.whlCollecting six  Using cached six-1.11.0-py2.py3-none-any.whlCollecting funcsigs>=1; python_version < "3.3" (from mock)  Using cached funcsigs-1.0.2-py2.py3-none-any.whlCollecting pbr>=0.11 (from mock)  Using cached pbr-3.1.1-py2.py3-none-any.whlInstalling collected packages: six, funcsigs, pbr, mockException: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 784, in install    **kwargs  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 851, in install    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files    isolated=self.isolated,  File "/Library/Python/2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files    clobber(source, lib_dir, True)  File "/Library/Python/2.7/site-packages/pip/wheel.py", line 323, in clobber    shutil.copyfile(srcfile, destfile)  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile    with open(dst, 'wb') as fdst:IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/six.py'

 

参考:

pip install mock --ignore-installed six --user

又遇到错误:

Collecting mock  Using cached mock-2.0.0-py2.py3-none-any.whlCollecting six  Using cached six-1.11.0-py2.py3-none-any.whlCollecting funcsigs>=1; python_version < "3.3" (from mock)  Using cached funcsigs-1.0.2-py2.py3-none-any.whlCollecting pbr>=0.11 (from mock)  Using cached pbr-3.1.1-py2.py3-none-any.whlInstalling collected packages: six, funcsigs, pbr, mockException: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 784, in install    **kwargs  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 851, in install    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files    isolated=self.isolated,  File "/Library/Python/2.7/site-packages/pip/wheel.py", line 492, in move_wheel_files    maker.make_multiple(['%s = %s' % kv for kv in console.items()])  File "/Library/Python/2.7/site-packages/pip/_vendor/distlib/scripts.py", line 383, in make_multiple    filenames.extend(self.make(specification, options))  File "/Library/Python/2.7/site-packages/pip/_vendor/distlib/scripts.py", line 372, in make    self._make_script(entry, filenames, options=options)  File "/Library/Python/2.7/site-packages/pip/_vendor/distlib/scripts.py", line 276, in _make_script    self._write_script(scriptnames, shebang, script, filenames, ext)  File "/Library/Python/2.7/site-packages/pip/_vendor/distlib/scripts.py", line 250, in _write_script    self._fileop.write_binary_file(outname, script_bytes)  File "/Library/Python/2.7/site-packages/pip/_vendor/distlib/util.py", line 407, in write_binary_file    with open(path, 'wb') as f:IOError: [Errno 13] Permission denied: '/usr/local/bin/pbr'

 

最后:

(venv)➜  test git:(master) pip install mock --ignore-installed six --userCollecting mock  Using cached mock-2.0.0-py2.py3-none-any.whlCollecting six  Using cached six-1.11.0-py2.py3-none-any.whlCollecting funcsigs>=1; python_version < "3.3" (from mock)  Using cached funcsigs-1.0.2-py2.py3-none-any.whlCollecting pbr>=0.11 (from mock)  Using cached pbr-3.1.1-py2.py3-none-any.whlInstalling collected packages: six, funcsigs, pbr, mockSuccessfully installed funcsigs-1.0.2 mock-2.0.0 pbr-3.1.1 six-1.11.0

 

转载地址:http://xhafa.baihongyu.com/

你可能感兴趣的文章
Qt Style Sheet实践(四):行文本编辑框QLineEdit及自动补全
查看>>
[物理学与PDEs]第3章习题1 只有一个非零分量的磁场
查看>>
onInterceptTouchEvent和onTouchEvent调用时序
查看>>
android防止内存溢出浅析
查看>>
4.3.3版本之引擎bug
查看>>
SQL Server表分区详解
查看>>
STM32启动过程--启动文件--分析
查看>>
垂死挣扎还是涅槃重生 -- Delphi XE5 公布会归来感想
查看>>
淘宝的几个架构图
查看>>
linux后台运行程序
查看>>
Python异步IO --- 轻松管理10k+并发连接
查看>>
Oracle中drop user和drop user cascade的区别
查看>>
登记申请汇总
查看>>
Android Jni调用浅述
查看>>
CodeCombat森林关卡Python代码
查看>>
(二)Spring Boot 起步入门(翻译自Spring Boot官方教程文档)1.5.9.RELEASE
查看>>
Shell基础之-正则表达式
查看>>
JavaScript异步之Generator、async、await
查看>>
讲讲吸顶效果与react-sticky
查看>>
c++面向对象的一些问题1 0
查看>>