pip抛出"TypeError: deprecated()"错误
回答 3
浏览 8794
2022-10-12
我正在尝试安装一些软件包,但开始出现了错误。然后在ubuntu中使用多个命令来更新一些东西,但错误都是类似的。
pip install -U pip setuptools
or
python3 -m pip install --upgrade pip
or
sudo -H pip3 install --upgrade pip
以下是错误的样本
user@machine:~$ pip install cryptography
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==20.0.2', 'console_scripts', 'pip')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
from pip._internal.exceptions import CommandError
File "/usr/lib/python3/dist-packages/pip/_internal/exceptions.py", line 10, in <module>
from pip._vendor.six import iteritems
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 65, in <module>
vendored("cachecontrol")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
.
.
.
.
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 46, in <module>
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import SSL, crypto
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/SSL.py", line 19, in <module>
from OpenSSL.crypto import (
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/crypto.py", line 3224, in <module>
utils.deprecated(
TypeError: deprecated() got an unexpected keyword argument 'name'
我已经按照这里中的建议,用apt-get install libffi-dev python-dev python3-dev
和apt-get install build-essential libssl-dev
更新了系统。
3 个回答
#1楼
已采纳
得票数 9
OpenSSL中有些东西被破坏了,之后没有任何命令可以使用pip
。我甚至无法卸载pip
。
我手动删除了安装文件(很可能不是一个推荐的方法),用的是
sudo rm -rf /usr/local/lib/python3.8/dist-packages/OpenSSL
sudo rm -rf /usr/local/lib/python3.8/dist-packages/pyOpenSSL-22.1.0.dist-info/
并使用pip3 install pyOpenSSL==22.0.0
重新安装。另一个版本有一些问题,就像这里描述的那样。
#2楼
得票数 0
对我来说,即使是卸载pyOpenSSL也会遇到同样的错误TypeError: deprecated() got an unexpected keyword argument 'name'
。
所以我先把pip升级到了23.0,卸载了PyOpenSSL,手动删除了/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
的openSSL文件夹,然后安装了PyOpenSSL 20.0.0
,最后问题得到了解决。
#3楼
得票数 0