由于密码学问题,无法在使用 Python 2.6 的 RHEL 6 上安装 pywinrm 模块。它指向 cffi

Installation of pywinrm module on RHEL 6 with Python 2.6 does not proceed due to cryptography. It points to cffi

我一直在尝试在我的 Ansible 控制服务器上安装 pywinrm 模块,该服务器是 运行 在 RHEL 6 上 Python 2.6(预安装)。

但是依赖加密模块失败并出现错误:

    Installing collected packages: cryptography
    Running setup.py install for cryptography ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-QE26MW/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-BhDfJs-record/install-record.txt --single-version-externally-managed --compile:
    Couldn't find index page for 'cffi' (maybe misspelled?)
    No local packages or download links found for cffi>=1.7
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-QE26MW/cryptography/setup.py", line 307, in <module>
        **keywords_with_side_effects(sys.argv)
    File "/usr/lib64/python2.6/distutils/core.py", line 113, in setup
        _setup_distribution = dist = klass(attrs)
    File "/usr/lib/python2.6/site-packages/setuptools/dist.py", line 221, in __init__
        self.fetch_build_eggs(attrs.pop('setup_requires'))
    File "/usr/lib/python2.6/site-packages/setuptools/dist.py", line 245, in fetch_build_eggs
        parse_requirements(requires), installer=self.fetch_build_egg
    File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 538, in resolve
        dist = best[req.key] = env.best_match(req, self, installer)
    File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 780, in best_match
        return self.obtain(req, installer) # try and download/install
    File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 792, in obtain
        return installer(requirement)
    File "/usr/lib/python2.6/site-packages/setuptools/dist.py", line 293, in fetch_build_egg
        return cmd.easy_install(req)
    File "/usr/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 466, in easy_install
        raise DistutilsError(msg)
    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('cffi>=1.7')

    ----------------------------------------
    Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-QE26MW/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-BhDfJs-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-QE26MW/cryptography/

有人建议更新 cffi 模块,但这没有帮助,因为它说它已经是最新的:

    [root@BLRCSLLIQQA0005 cryptography]# pip install -U cffi
    DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
    /usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
      SNIMissingWarning
    /usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
      InsecurePlatformWarning
    Requirement already up-to-date: cffi in /usr/lib64/python2.6/site-packages
    Requirement already up-to-date: pycparser in /usr/lib/python2.6/site-packages (from cffi)

cryptography 的安装文档中,我将 libffi-devel 视为依赖项。但是当我尝试安装时,我得到:

     cryptography]#  sudo yum install redhat-rpm-config gcc libffi-devel
    Loaded plugins: product-id, refresh-packagekit, subscription-manager
    This system is receiving updates from Red Hat Subscription Management.
    rhel-6-server-rpms                                                                                                                                  | 3.5 kB     00:00     
    rhel-server-dts-6-rpms                                                                                                                              | 3.4 kB     00:00     
    rhel-server-dts2-6-rpms                                                                                                                             | 3.2 kB     00:00     
    Setting up Install Process
    Package redhat-rpm-config-9.0.3-51.el6.noarch already installed and latest version
    Package gcc-4.4.7-18.el6.x86_64 already installed and latest version
    No package libffi-devel available.
    Nothing to do

这是我的 pip 堆栈,

    cryptography]# pip freeze
    DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
    ansible==2.3.1.0
    asn1crypto==0.23.0
    Babel==0.9.4
    Beaker==1.3.1
    cas==0.15
    certifi==2017.7.27.1
    cffi==1.11.2
    chardet==3.0.4
    cups==1.0
    cupshelpers==1.0
    decorator==3.0.1
    enum34==1.1.6
    ethtool==0.6
    firstboot==1.110
    freeipa==2.0.0a0
    httplib2==0.7.7
    idna==2.6
    iniparse==0.3.1
    iotop==0.3.2
    ipaddress==1.0.18
    ipapython==2.1.3
    iwlib==1.0
    kerberos==1.1
    lxml==2.2.3
    M2Crypto==0.20.2
    Magic-file-extensions==0.1
    Mako==0.3.4
    MarkupSafe==0.9.2
    matplotlib==0.99.1.1
    ndg-httpsclient==0.4.3
    netaddr==0.7.5
    nose==0.10.4
    numpy==1.3.0
    ordereddict==1.2
    paramiko==1.7.5
    passlib==1.7.1
    pyasn1==0.0.12a0
    pycparser==2.18
    pycrypto==2.0.1
    pycurl==7.19.0
    pygpgme==0.1
    pykerberos==1.1.14
    pyOpenSSL==0.10
    python-dateutil==1.4.1
    python-default-encoding==0.1
    python-dmidecode==3.10.13
    python-keyczar==0.71rc0
    python-ldap==2.3.10
    python-meh==0.11
    python-nss==0.11
    pytz===2010h
    pyxdg==0.18
    PyXML==0.8.4
    PyYAML==3.10
    requests==2.18.4
    requests-kerberos==0.11.0
    rhnlib==2.5.22
    rhsm==1.1.8
    scdate==1.9.60
    scservices==0.99.45
    scservices.dbus==0.99.45
    simplejson==2.0.9
    six==1.9.0
    slip==0.2.11
    slip.dbus==0.2.11
    slip.gtk==0.2.11
    smbc==1.0
    SSSDConfig==1
    urlgrabber==3.9.1
    urllib3==1.22
    virtinst==0.600.0
    xmltodict==0.11.0
    yum-metadata-parser==1.1.2

如果您需要任何进一步的信息,请告诉我。这是一个主要障碍。我找不到任何有相同问题的博客或帖子。

Python2.6 已贬值且不再维护。尝试将其升级到最新版本