试图卸载Mac上的所有pip
和pip3
软件包,但我遇到了以下错误,这些错误主要与OSError: [Errno 30] Read-only file system:
和[Errno 1] Operation not permitted:
有关。我已经试过:
csrutil disable
并在禁用csrutil
时运行卸载命令csrutil
时尝试sudo -H
卸载以下是错误:
第一:SIP状态以及pip
和pip3
信息
$ csrutil status
System Integrity Protection status: disabled.
$ pip list
zsh: command not found: pip
$ python -m pip list
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Package Version
-------------------------------------- --------
altgraph 0.10.2
asn1crypto 0.24.0
backports-abc 0.5
bdist-mpkg 0.5.0
bonjour-py 0.3
cffi 1.12.2
...
...
xattr 0.6.4
$ python3 -m pip list
Package Version
---------- -------
pip 19.2.3
setuptools 50.3.2
wheel 0.35.1
第二:尝试使用python -m pip freeze | xargs python -m pip uninstall -y
卸载所有pip
包
$ python -m pip freeze | xargs python -m pip uninstall -y
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Uninstalling pyobjc-framework-AppleScriptObjC-2.5.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/cli/base_command.py", line 176, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/commands/uninstall.py", line 75, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/req/req_install.py", line 823, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/req/req_uninstall.py", line 268, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/utils/misc.py", line 303, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 322, in move
copytree(src, real_dst, symlinks=True)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 231, in copytree
raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/AppleScriptObjC/_metadata.pyc', '/private/var/folders/74/01qhmy3s3qg_fwctkdf6mrvh0000gn/T/pip-temp-Udv2QQ/AppleScriptObjC/_metadata.pyc', "[Errno 1] Operation not permitted: '/private/var/folders/74/01qhmy3s3qg_fwctkdf6mrvh0000gn/T/pip-temp-Udv2QQ/AppleScriptObjC/_metadata.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/AppleScriptObjC/_metadata.py', '/private/var/folders/74/01qhmy3s3qg_fwctkdf6mrvh0000gn/T/pip-temp-Udv2QQ/AppleScriptObjC/_metadata.py', "[Errno 1] Operation not permitted: '/private/var/folders/74/01qhmy3s3qg_fwctkdf6mrvh0000gn/T/pip-temp-Udv2QQ/AppleScriptObjC/_metadata.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/AppleScriptObjC/__init__.py', '/private/var/folders/74/01qhmy3s3qg_fwctkdf6mrvh0000gn/T/pip-temp-Udv2QQ/AppleScriptObjC/__init__.py', "[Errno 1] Operation not permitted: '/private/var/folders/74/01qhmy3s3qg_fwctkdf6mrvh0000gn/T/pip-temp-Udv2QQ/AppleScriptObjC/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/AppleScriptObjC/__init__.pyc', '/private/var/folders/74/01qhmy3s3qg_fwctkdf6mrvh0000gn/T/pip-temp-Udv2QQ/AppleScriptObjC/__init__.pyc', "[Errno 1] Operation not permitted: '/private/var/folders/74/01qhmy3s3qg_fwctkdf6mrvh0000gn/T/pip-temp-Udv2QQ/AppleScriptObjC/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/AppleScriptObjC', '/private/var/folders/74/01qhmy3s3qg_fwctkdf6mrvh0000gn/T/pip-temp-Udv2QQ/AppleScriptObjC', "[Errno 1] Operation not permitted: '/private/var/folders/74/01qhmy3s3qg_fwctkdf6mrvh0000gn/T/pip-temp-Udv2QQ/AppleScriptObjC'")]
使用sudo python -m pip freeze | xargs sudo python -m pip uninstall -y
和sudo -H python -m pip freeze | xargs sudo -H python -m pip uninstall -y
重试
$ sudo python -m pip freeze | xargs sudo python -m pip uninstall -y
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
The directory '/Users/.../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.
Uninstalling pyobjc-framework-AppleScriptObjC-2.5.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/cli/base_command.py", line 176, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/commands/uninstall.py", line 75, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/req/req_install.py", line 823, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/req/req_uninstall.py", line 268, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/utils/misc.py", line 303, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 323, in move
rmtree(src)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 275, in rmtree
onerror(os.remove, fullname, sys.exc_info())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 273, in rmtree
os.remove(fullname)
OSError: [Errno 30] Read-only file system: '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/AppleScriptObjC/_metadata.pyc'
$ sudo -H python -m pip freeze | xargs sudo -H python -m pip uninstall -y
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Uninstalling pyobjc-framework-AppleScriptObjC-2.5.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/cli/base_command.py", line 176, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/commands/uninstall.py", line 75, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/req/req_install.py", line 823, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/req/req_uninstall.py", line 268, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-19.0.1-py2.7.egg/pip/_internal/utils/misc.py", line 303, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 323, in move
rmtree(src)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 275, in rmtree
onerror(os.remove, fullname, sys.exc_info())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 273, in rmtree
os.remove(fullname)
OSError: [Errno 30] Read-only file system: '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/AppleScriptObjC/_metadata.pyc'
这里对Apple Stack进行了简要讨论:https://apple.stackexchange.com/questions/209572/how-to-use-pip-after-the-os-x-el-capitan-upgrade/209583但重点是安装问题
目前没有回答
相关问题 更多 >
编程相关推荐