我最近在我的ubuntu20.04中安装了python 3.10。我的安装步骤是:
apt install python3.10
apt install python3.10-dev
apt install python3.10-distutils
问题在于pip
。当我试图安装任何有错误的东西时,它会崩溃:
ImportError: cannot import name 'html5lib' from 'pip._vendor' (/usr/lib/python3/dist-packages/pip/_vendor/__init__.py)
我的系统上安装了python 3.6-3.9版本。此问题仅在python 3.10
中出现。造成这个问题的原因和解决办法是什么?
发布于 2021-11-16 11:06:17
通过进入pipenv外壳并在那里安装pip,我解决了完全相同的症状:
pipenv shell
curl -sS https://bootstrap.pypa.io/get-pip.py | python
这导致:
Collecting pip
Using cached pip-21.3.1-py3-none-any.whl (1.7 MB)
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-21.3.1
从那以后,事情开始像预期的那样开始运作,pipenv install
也成功了。无数其他安装和重新安装python/pip/pipenv的方法失败,多次出现相同的导入错误。
发布于 2022-04-08 10:11:44
以下命令解决了我的pip
和sudo pip
问题:
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
curl -sS https://bootstrap.pypa.io/get-pip.py | sudo python3.10
发布于 2021-10-28 12:06:18
最好使用pyenv和/或virtualenv。有些lib与不同的python版本不兼容。另外,pip不知道您希望安装所请求的lib的python版本。
这里有一些教程,或者去youtube上搜索。
https://realpython.com/intro-to-pyenv/ https://docs.python.org/3/library/venv.html
https://askubuntu.com/questions/1372119
复制相似问题