提问者:小点点

pip抛出“TypeError:弃用()”错误


我试图安装一些软件包,并开始得到一个错误。然后在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-devapt-get install build-基本libssl-dev更新了系统


共3个答案

匿名用户

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重新安装。另一个版本有一些问题,如此处所述。

匿名用户

对我来说,即使卸载pyOpenSSL也会遇到相同的错误TypeError:已弃用()得到了一个意外的关键字参数'name'

所以首先我将pip升级到23.0,卸载PyOpenSSL,从/Library/Framework/Python. frame/Versions/3.7/lib/python3.7/site-包手动删除openSSL文件夹,然后安装PyOpenSSL 20.0.0,最终问题解决。

匿名用户

升级pyOpenSSL对我有用!

pip install pyOpenSSL --upgrade