安装pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3 get-pip.py
报错:
Traceback (most recent call last):
File "/home/coder/get-pip.py", line 32099, in <module>
main()
File "/home/coder/get-pip.py", line 135, in main
bootstrap(tmpdir=tmpdir)
File "/home/coder/get-pip.py", line 111, in bootstrap
monkeypatch_for_cert(tmpdir)
File "/home/coder/get-pip.py", line 92, in monkeypatch_for_cert
from pip._internal.commands.install import InstallCommand
File "<frozen zipimport>", line 259, in load_module
File "/tmp/tmpw0gfa0kk/pip.zip/pip/_internal/commands/__init__.py", line 9, in <module>
File "<frozen zipimport>", line 259, in load_module
File "/tmp/tmpw0gfa0kk/pip.zip/pip/_internal/cli/base_command.py", line 15, in <module>
File "<frozen zipimport>", line 259, in load_module
File "/tmp/tmpw0gfa0kk/pip.zip/pip/_internal/cli/cmdoptions.py", line 24, in <module>
File "<frozen zipimport>", line 259, in load_module
File "/tmp/tmpw0gfa0kk/pip.zip/pip/_internal/cli/parser.py", line 12, in <module>
File "<frozen zipimport>", line 259, in load_module
File "/tmp/tmpw0gfa0kk/pip.zip/pip/_internal/configuration.py", line 26, in <module>
File "<frozen zipimport>", line 259, in load_module
File "/tmp/tmpw0gfa0kk/pip.zip/pip/_internal/utils/logging.py", line 29, in <module>
File "<frozen zipimport>", line 259, in load_module
File "/tmp/tmpw0gfa0kk/pip.zip/pip/_internal/utils/misc.py", line 42, in <module>
File "<frozen zipimport>", line 259, in load_module
File "/tmp/tmpw0gfa0kk/pip.zip/pip/_internal/locations/__init__.py", line 67, in <module>
File "<frozen zipimport>", line 259, in load_module
File "/tmp/tmpw0gfa0kk/pip.zip/pip/_internal/locations/_distutils.py", line 20, in <module>
ModuleNotFoundError: No module named 'distutils.cmd'
发现系统缺少distutils,安装distutils
sudo apt-get install python3-distutils
报错:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python3-distutils
更新系统源
sudo apt-get update
然后执行
sudo apt-get install python3-distutils
执行
sudo python3 get-pip.py
执行pip –version
pip 22.2.2 from /usr/local/lib/python3.9/dist-packages/pip (python 3.9)
pip安装成功