如何解决从OSX上可怕的pip / pip3混乱中恢复
我只想安装lang软件包。 这里的问题是我花了很长时间安装了无数软件包,并且不想再做一遍。我不是python包管理的专家,我宁愿不需要成为一个。这是因为我剪切并粘贴了Stack Overflow的答案,只是天真的希望它是正确的(请参见下文)。
有没有一种方法可以简单地删除pip安装并保留已安装的软件包信息,然后使用旧的软件包信息再次重新安装pip3?
我想象pip必须将软件包信息保存在某个数据库中,所以我可能可以将其复制出来,重新安装一个新的pip,然后再复制回软件包数据?
〜/ Dropbox / Projects / FileSorting / ScreenShotSorter $ pip3 install lang
Collecting lang
Downloading lang-1.0.5.tar.gz (5.7 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python@3.8/bin/python3.8 -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/private/var/folders/01/gll908b94ll0m5mzltylkp4w0000gn/T/pip-install-y291uctu/lang/setup.py'"'"'; __file__='"'"'/private/var/folders/01/gll908b94ll0m5mzltylkp4w0000gn/T/pip-install-y291uctu/lang/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/01/gll908b94ll0m5mzltylkp4w0000gn/T/pip-install-y291uctu/lang/pip-egg-info
cwd: /private/var/folders/01/gll908b94ll0m5mzltylkp4w0000gn/T/pip-install-y291uctu/lang/
Complete output (7 lines):
Traceback (most recent call last):
File "<string>",line 1,in <module>
File "/private/var/folders/01/gll908b94ll0m5mzltylkp4w0000gn/T/pip-install-y291uctu/lang/setup.py",line 14,in <module>
with open(path.join(here,'..','README.md'),encoding='utf-8') as f:
File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/codecs.py",line 905,in open
file = builtins.open(filename,mode,buffering)
FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/01/gll908b94ll0m5mzltylkp4w0000gn/T/pip-install-y291uctu/lang/../README.md'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
(这很奇怪,我应该如何解决?也许pip已过期?我不记得升级命令,所以我只能从Stack Overflow中获取它。)
〜/ Dropbox / Projects / FileSorting / ScreenShotSorter $ sudo -H pip3 install --upgrade pip
(完全不明显的是,它不会升级正确版本的pip,而这会破坏一切。)
Password:
Collecting pip
Downloading pip-20.2.2-py2.py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 1.7 MB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.0.2
Uninstalling pip-20.0.2:
Successfully uninstalled pip-20.0.2
Successfully installed pip-20.2.2
〜/ Dropbox / Projects / FileSorting / ScreenShotSorter $ sudo -H pip3 install --upgrade pip3
(也许应该是应该在这里升级的pip3?)
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py",line 584,in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py",line 901,in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py",line 792,in resolve
raise VersionConflict(dist,req).with_context(dependent_req)
pkg_resources.VersionConflict: (pip 20.2.2 (/usr/local/lib/python3.8/site-packages),Requirement.parse('pip==20.0.2'))
During handling of the above exception,another exception occurred:
Traceback (most recent call last):
File "/usr/local/opt/python@3.8/bin/pip3",line 6,in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py",line 3255,in <module>
def _initialize_master_working_set():
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py",line 3238,in _call_aside
f(*args,**kwargs)
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py",line 3267,in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py",line 586,in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py",line 599,in _build_from_requirements
dists = ws.resolve(reqs,Environment())
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py",line 787,in resolve
raise DistributionNotFound(req,requirers)
pkg_resources.DistributionNotFound: The 'pip==20.0.2' distribution was not found and is required by the application
〜/ Dropbox / Projects / FileSorting / ScreenShotSorter $ pip3安装语言
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py",requirers)
pkg_resources.DistributionNotFound: The 'pip==20.0.2' distribution was not found and is required by the application
〜/ Dropbox / Projects / FileSorting / ScreenShotSorter $ 其中点
/usr/local/bin/pip
〜/ Dropbox / Projects / FileSorting / ScreenShotSorter $ sudo pip卸载pip
(也许摆脱伪造的pip会有所帮助吗?)
WARNING: The directory '/Users/xxx/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo,you may want sudo's -H flag.
Found existing installation: pip 20.2.2
Uninstalling pip-20.2.2:
Would remove:
/usr/local/bin/pip
/usr/local/bin/pip3
/usr/local/bin/pip3.8
/usr/local/lib/python3.8/site-packages/pip-20.2.2.dist-info/*
/usr/local/lib/python3.8/site-packages/pip/*
Proceed (y/n)? y
Successfully uninstalled pip-20.2.2
〜/ Dropbox / Projects / FileSorting / ScreenShotSorter $ pip3
Traceback (most recent call last):
File "/usr/local/opt/python@3.8/bin/pip3",requirers)
pkg_resources.DistributionNotFound: The 'pip==20.0.2' distribution was not found and is required by the application
〜/ Dropbox / Projects / FileSorting / ScreenShotSorter $ 其中pip3
/usr/local/opt/python@3.8/bin/pip3
〜/ Dropbox / Projects / FileSorting / ScreenShotSorter $ 点
zsh: command not found: pip
〜/ Dropbox / Projects / FileSorting / ScreenShotSorter $ 其中为python3
/usr/local/opt/python@3.8/bin/python3
〜/ Dropbox / Projects / FileSorting / ScreenShotSorter $ pip3卸载pip3
Traceback (most recent call last):
File "/usr/local/opt/python@3.8/bin/pip3",requirers)
pkg_resources.DistributionNotFound: The 'pip==20.0.2' distribution was not found and is required by the application
〜/ Dropbox / Projects / FileSorting / ScreenShotSorter $ 查找/ -name pip 2> / dev / null
/usr/local/lib/python3.6/site-packages/pip
/usr/local/lib/python3.7/site-packages/pip
/usr/local/lib/python2.7/site-packages/pip
/usr/local/Cellar/python@2/2.7.15_3/bin/pip
/usr/local/Cellar/python@2/2.7.15_3/libexec/pip
/usr/local/Cellar/python@2/2.7.15_3/libexec/pip/build/lib/pip
/usr/local/Cellar/python@2/2.7.15_3/libexec/pip/src/pip
/usr/local/Cellar/python/3.7.6_1/libexec/pip
/usr/local/Cellar/python/3.7.6_1/libexec/pip/src/pip
/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/msi/pip
/usr/local/Cellar/python@3.8/3.8.2/libexec/bin/pip
/usr/local/Cellar/python@3.8/3.8.2/libexec/pip
/usr/local/Cellar/python@3.8/3.8.2/libexec/pip/build/lib/pip
/usr/local/Cellar/python@3.8/3.8.2/libexec/pip/src/pip
/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/share/doc/python3.8/examples/Tools/msi/pip
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip
/Library/Python/2.7/site-packages/pip-19.2.2-py2.7.egg/pip
/System/Volumes/Data/usr/local/lib/python3.6/site-packages/pip
/System/Volumes/Data/usr/local/lib/python3.7/site-packages/pip
/System/Volumes/Data/usr/local/lib/python2.7/site-packages/pip
/System/Volumes/Data/usr/local/Cellar/python@2/2.7.15_3/bin/pip
/System/Volumes/Data/usr/local/Cellar/python@2/2.7.15_3/libexec/pip
/System/Volumes/Data/usr/local/Cellar/python@2/2.7.15_3/libexec/pip/build/lib/pip
/System/Volumes/Data/usr/local/Cellar/python@2/2.7.15_3/libexec/pip/src/pip
/System/Volumes/Data/usr/local/Cellar/python/3.7.6_1/libexec/pip
/System/Volumes/Data/usr/local/Cellar/python/3.7.6_1/libexec/pip/src/pip
/System/Volumes/Data/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/msi/pip
/System/Volumes/Data/usr/local/Cellar/python@3.8/3.8.2/libexec/bin/pip
/System/Volumes/Data/usr/local/Cellar/python@3.8/3.8.2/libexec/pip
/System/Volumes/Data/usr/local/Cellar/python@3.8/3.8.2/libexec/pip/build/lib/pip
/System/Volumes/Data/usr/local/Cellar/python@3.8/3.8.2/libexec/pip/src/pip
/System/Volumes/Data/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/share/doc/python3.8/examples/Tools/msi/pip
/System/Volumes/Data/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip
/System/Volumes/Data/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip
/System/Volumes/Data/Library/Python/2.7/site-packages/pip-19.2.2-py2.7.egg/pip
/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip
/Users/robotbugs/Library/Caches/pip
/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip
〜/ Dropbox / Projects / FileSorting / ScreenShotSorter $ echo“ What the f__k \!”
(所有这些python版本是什么-我以为我在使用3.8?)
What the f__k!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。