这是python36版本的问题吗?怎么解决呢?

时间:2019-11-12 16:45:54

标签: python-requests python-3.6

我正在使用RHEL。我按照https://www.rosehosting.com/blog/how-to-install-python-3-6-4-on-centos-7/安装了python。尝试安装requests-kerberos时出现错误

pip3 install requests-kerberos

返回

src/kerberos.c:17:20: fatal error: Python.h: No such file or directory
 #include <Python.h>
                    ^
compilation terminated.
error: command 'gcc' failed with exit status 1

sudo yum install gcc

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager 
Package gcc-4.8.5-39.el7.x86_64 already installed and latest version 
Nothing to do

然后我尝试了

sudo yum install python3-devel

得到

  Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
No package python3-devel available.
Error: Nothing to do

然后我尝试了

sudo yum install python36-devel

得到

    Error: Package: python36-devel-3.6.8-2.el7.ius.x86_64 (ius)
           Requires: python36 = 3.6.8-2.el7.ius
           Installed: python3-3.6.8-10.el7.x86_64 (@rhel-7-server-rpms)
               python36 = 3.6.8-10.el7
           Available: python36-3.6.8-2.el7.ius.x86_64 (ius)
               python36 = 3.6.8-2.el7.ius
Error: Package: python36-devel-3.6.8-2.el7.ius.x86_64 (ius)
           Requires: python36-libs(x86-64) = 3.6.8-2.el7.ius
           Installed: python3-libs-3.6.8-10.el7.x86_64 (@rhel-7-server-rpms)
               python36-libs(x86-64) = 3.6.8-10.el7
           Available: python36-libs-3.6.8-2.el7.ius.x86_64 (ius)
               python36-libs(x86-64) = 3.6.8-2.el7.ius

1 个答案:

答案 0 :(得分:2)

您正在使用RHEL,但您仍在关注随机的Centos博客文章。以下是来自Red Hat Developers Blog的有关在Centos和RHEL(6或7)上使用更好的python36的一些建议的摘要:

  1. 启用SCL

    软件集合是RedHat Satellite存储库,如果您的服务器之间存在空隙(即没有互联网),它们也可以使用。

    在Centos上:

    yum install centos-release-scl

    在RHEL7上

    yum-config-manager-启用rhel-server-rhscl-7-rpms

  2. 安装主SCL软件包:

    yum install rh-python36

  3. 开始使用刚安装的软件集合:

    scl启用rh-python36 bash

  4. 自行升级pip3,并更新设置工具:

    pip3 install --upgrade pip

    pip3 install --upgrade setuptools

  5. 安装请求-kerberos:

    pip3安装请求-kerberos

注释

    1. 等同于bash采购文件/opt/rh/rh-python36/enable
    1. 通过安装这些主软件包就足够了:

rh-python36 dependencies (libs, headers, pip, setuptools)