无法在 Linux 上安装 PIP

无法在 Linux 上安装 PIP

我尝试在 Linux 环境中安装 pip,但安装不正确。

Python 版本 - 2.6.6

当我尝试使用以下命令安装 pip 时,

python setup.py 安装

以下是我收到的消息。

running install
running bdist_egg
running egg_info
writing src/pip.egg-info/PKG-INFO
writing top-level names to src/pip.egg-info/top_level.txt
writing dependency_links to src/pip.egg-info/dependency_links.txt
writing entry points to src/pip.egg-info/entry_points.txt
reading manifest file 'src/pip.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'docs/docutils.conf'
...............
...............
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/cachecontrol/adapter.py to adapter.pyc
SyntaxError: ('invalid syntax', ('build/bdist.linux-x86_64/egg/pip/_vendor/cachecontrol/adapter.py', 13, 34, '    invalidating_methods = {"PUT", "DELETE"}\n'))

byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/cachecontrol/heuristics.py to heuristics.pyc
SyntaxError: ('invalid syntax', ('build/bdist.linux-x86_64/egg/pip/_vendor/cachecontrol/heuristics.py', 101, 12, '        200, 203, 204, 206, 300, 301, 404, 405, 410, 414, 501\n'))

byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/help.py to help.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/exceptions.py to exceptions.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/_internal_utils.py to _internal_utils.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/status_codes.py to status_codes.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/api.py to api.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/sessions.py to sessions.pyc
SyntaxError: ('invalid syntax', ('build/bdist.linux-x86_64/egg/pip/_vendor/requests/sessions.py', 750, 52, '        state = {attr: getattr(self, attr, None) for attr in self.__attrs__}\n'))
SyntaxError: ('invalid syntax', ('build/bdist.linux-x86_64/egg/pip/_vendor/requests/models.py', 655, 51, '        return {attr: getattr(self, attr, None) for attr in self.__attrs__}\n'))

但在错误消息的最后,

SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg/pip/_internal/req/req_uninstall.py', 180, 37, '        os.path.join(folder, "*") for folder in folders\n'))

SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg/pip/_internal/cli/parser.py', 157, 37, '        section_items = {name: [] for name in override_order}\n'))

SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg/pip/_internal/cli/cmdoptions.py', 96, 48, "    binary_only = FormatControl(set(), {':all:'})\n"))

pip 19.0.3 is already the active version in easy-install.pth
Installing pip script to /usr/bin
Installing pip2.6 script to /usr/bin
Installing pip2 script to /usr/bin

Installed /usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg
Processing dependencies for pip==19.0.3
Finished processing dependencies for pip==19.0.3

当我检查 pip 版本时,它给出了以下结果,

$ pip --version    
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==19.0.3', 'console_scripts', 'pip')()
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 299, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2229, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1948, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg/pip/_internal/__init__.py", line 19, in <module>
    from pip._vendor.urllib3.exceptions import DependencyWarning
  File "/usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg/pip/_vendor/urllib3/__init__.py", line 8, in <module>
    from .connectionpool import (
  File "/usr/lib/python2.6/site-packages/pip-19.0.3-py2.6.egg/pip/_vendor/urllib3/connectionpool.py", line 92
    _blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK}

以下是Linux系统的详细信息,

$ uname -r
2.6.32-279.11.1.el6.x86_64

$ cat /etc/system-release-cpe
cpe:/o:oracle:oracle_linux:6server:ga:server

$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)

答案1

你可能最好安装“python-pip” EPEL比手动安装。根据您所做的操作,您可能已经导致主机无法通过“yum”获取任何软件更新,因为 python 库损坏。

此外,如果您确实运行 Oracle Linux 6.3,那么您的系统至少已经使用了 6 年。

相关内容