我已经尝试了这个 PIP 损坏问题的所有方法

我已经尝试了这个 PIP 损坏问题的所有方法

每次我遇到这个问题时,我只是复制我的文件并安装新的kali副本,然后再次更新系统并复制重新下载我的应用程序的要求,我不知道它到底发生在哪里或何时,唯一的解决方法是使用环境活跃 pip3 工作正常

root@kali:~# which pip
/usr/local/bin/pip
root@kali:~# whereis pip
pip: /usr/bin/pip /usr/local/bin/pip /usr/local/bin/pip2.7 
/usr/share/man/man1/pip.1.gz



root@kali:~# pip
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 11, in <module>
    load_entry_point('pip==18.1', 'console_scripts', 'pip')()
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 487, in load_entry_point
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2728, in load_entry_point
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2346, in load
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 2352, in resolve
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1-py2.7.egg/pip/_internal/__init__.py", line 40, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1-py2.7.egg/pip/_internal/cli/autocompletion.py", line 8, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1-py2.7.egg/pip/_internal/cli/main_parser.py", line 12, in <module>
    from pip._internal.commands import (
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1-py2.7.egg/pip/_internal/commands/__init__.py", line 6, in <module>
    from pip._internal.commands.completion import CompletionCommand
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1-py2.7.egg/pip/_internal/commands/completion.py", line 6, in <module>
    from pip._internal.cli.base_command import Command
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1-py2.7.egg/pip/_internal/cli/base_command.py", line 18, in <module>
    from pip._internal.download import PipSession
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1-py2.7.egg/pip/_internal/download.py", line 15, in <module>
    from pip._vendor import requests, six, urllib3
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1-py2.7.egg/pip/_vendor/requests/__init__.py", line 97, in <module>
    from pip._vendor.urllib3.contrib import pyopenssl
  File "/usr/local/lib/python2.7/dist-packages/pip-18.1-py2.7.egg/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/local/lib/python2.7/dist-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/local/lib/python2.7/dist-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/crypto.py", line 12, in <module>
    from cryptography import x509
  File "/usr/lib/python2.7/dist-packages/cryptography/x509/__init__.py", line 8, in <module>
    from cryptography.x509.base import (
  File "/usr/lib/python2.7/dist-packages/cryptography/x509/base.py", line 16, in <module>
    from cryptography.x509.extensions import Extension, ExtensionType
  File "/usr/lib/python2.7/dist-packages/cryptography/x509/extensions.py", line 18, in <module>
    from cryptography.hazmat.primitives import constant_time, serialization
  File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/primitives/constant_time.py", line 11, in <module>
    from cryptography.hazmat.bindings._constant_time import lib
AttributeError: 'module' object has no attribute '_init_cffi_1_0_external_module'

答案1

如果 pip 搞砸了。那么最好的选择是使用您在发行版上安装 python 时使用的相同软件包系统来重新安装它。

下一步是获取蟒蛇环境使用以下方法自行修复:

python -m ensurepip

python -m ensurepip --upgrade

如果失败你可以尝试引导脚本- 用curl获取它:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

然后执行:

python get-pip.py

相关内容