pip3 install不工作,而且pip3也不能从Pip20.0降级到pip19:
Rayaans-MacBook-Pro:~ rayaangrewal$ pip3 install
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/pip3", line 10, in <module>
sys.exit(main())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/commands/__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 20, in <module>
from pip._internal.operations.prepare import RequirementPreparer
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 16, in <module>
from pip._internal.distributions import (
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/distributions/__init__.py", line 1, in <module>
from pip._internal.distributions.source import SourceDistribution
ImportError: cannot import name 'SourceDistribution' from 'pip._internal.distributions.source' (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/distributions/source/__init__.py)发布于 2020-01-22 04:27:31
这是pip 20.0中的一个错误;请参阅https://github.com/pypa/pip/issues/7620
它已在pip 20.0.1中修复。升级到20.0.1+或降级到19.3.1。获取get-pip.py并运行
python get-pip.py或
python get-pip.py pip==19.3.1发布于 2020-01-24 21:59:54
在@pdh的github问题链接中回答得很好。
当在Ubuntu/LXC上使用 3.6+中的Python venv时,在执行过程中使用自安装/自升级pip命令时,可以使用get-pip.py:
bin/pip3 install --upgrade pip
cd bin
# downloading get-pip.py each time; but you could also remove it from here
# and run this manually only once:
wget https://bootstrap.pypa.io/get-pip.py -O ./get-pip.py
# definitely keep this command:
python3 get-pip.py
cd ..结果:
Collecting pip
...
Installing collected packages: pip
Found existing installation: pip 20.0.0
Uninstalling pip-20.0.0:
Successfully uninstalled pip-20.0.0
Successfully installed pip-20.0.1get-pip.py备注:
除非--force-reinstall
--no-wheel特别禁用,否则
3.6),并且它将固有地使用参数install、--upgrade、--force-reinstall
--no-setuptools和wheelGET-PIP.PY警告
根据友好的错误消息WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.,可以将上面的第3点替换为:
bin/python3 -m pip install -U pip [setuptools] [wheel] [--no-cache-dir]发布于 2020-02-26 19:23:36
安装新版本的pip可以解决这个问题:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.pyhttps://stackoverflow.com/questions/59842600
复制相似问题