无法使用 pip、Urllib3 NTLM

Can't use pip, Urllib3 NTLM

1 - 环境

pip 版本:20.1.1-2

Python版本:2.x3.03.8.

OS: linux

2 - 如何重现

只需尝试使用 pip。

注意:pythonx -m pip 不存在

画中画使用 python3.9 -m pip

3 - 命令

pip

4 - 输出

Traceback (most recent call last):
File “/usr/bin/pip”, line 11, in
load_entry_point(‘pip==20.1.1’, ‘console_scripts’, ‘pip’)()
File “/usr/lib/python3/dist-packages/pkg_resources/ init .py”, line 473, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python3/dist-packages/pkg_resources/ init .py”, line 2843, in load_entry_point
return ep.load()
File “/usr/lib/python3/dist-packages/pkg_resources/ init .py”, line 2447, in load
return self.resolve()
File “/usr/lib/python3/dist-packages/pkg_resources/ init .py”, line 2453, 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
from pip._internal.cli.autocompletion import autocomplete
File “/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py”, line 9, in
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
from pip._internal.cli import cmdoptions
File “/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py”, line 24, in
from pip._internal.cli.progress_bars import BAR_TYPES
File “/usr/lib/python3/dist-packages/pip/_internal/cli/progress_bars.py”, line 7, in
from pip._vendor import six
File “/usr/lib/python3/dist-packages/pip/_vendor/ init .py”, line 93, in
vendored(“requests.packages.urllib3.contrib.ntlmpool”)
File “/usr/lib/python3/dist-packages/pip/_vendor/ init .py”, line 36, in vendored
import (modulename, globals(), locals(), level=0)
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 655, in _load_unlocked
File “”, line 618, in _load_backward_compatible
File “”, line 259, in load_module
File “/usr/share/python-wheels/urllib3-1.25.9-py2.py3-none-any.whl/urllib3/contrib/ntlmpool.py”, line     9, in
File “/usr/local/lib/python3.8/dist-packages/ntlm/ntlm.py”, line 112
print “NTLM_NegotiateUnicode set”
^
SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(“NTLM_NegotiateUnicode set”)?

我真的需要帮助:
我一直在尝试 --reinstall 但没有用。

我认为您使用了错误的 pip 和错误的 python 版本。

据我所知,您正在尝试将 pip 用于 python2.xpython3.x。最简单的解决方案是使用相应的 pip 版本和 python 版本。

例如:

pip -> python2.7

pip3 -> python3 - python3.7 最常见 python3.6

pip3.8 -> python3.8

等等...

替代解决方案包括...

  • 解决方案 #1:

转到您的 .bashrc 文件并添加

alias pip=python3.8 -m pip # 3.8 can be replaced with pip version

保存并重启终端。

  • 解决方案 #2:

卸载 python3.8 并从源代码构建它。检查此 tutorial 如何做到这一点。

感谢 Deep_Thoughts 尝试帮助我,伙计,我解决了错误并在每个 python 版本中使用 get-pip.py 脚本手动安装 pip。

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

我下载它并且 运行 每个 python 版本。现在

pip

运行 对。