【问题标题】:Is this python36 version issue? How to resolve it?这是python36版本的问题吗?如何解决?
【发布时间】:2019-11-12 16:45:54
【问题描述】:

我在 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 安装 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

【问题讨论】:

    标签: python-requests python-3.6


    【解决方案1】:

    您使用的是 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 --enable rhel-server-rhscl-7-rpms

    2. 安装主 SCL 包:

      yum 安装 rh-python36

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

      scl 启用 rh-python36 bash

    4. 自行升级 pip3,并更新 setuptools:

      pip3 install --upgrade pip

      pip3 install --upgrade setuptools

    5. 安装 requests-kerberos:

      pip3 安装请求-kerberos

    注意事项

      1. 相当于 bash 获取文件 /opt/rh/rh-python36/enable
      1. 安装主要软件包就足够了:

    【讨论】:

    • 有 rh-python36 可用于 Ubuntu 吗? 'rh' 表示 RedHat,对吗?
    • rh- 确实是 Red Hat,不适用于 Ubuntu。
    猜你喜欢
    • 1970-01-01
    • 2020-09-28
    • 1970-01-01
    • 2011-11-23
    • 2021-09-11
    • 1970-01-01
    • 1970-01-01
    • 2020-07-18
    • 1970-01-01
    相关资源
    最近更新 更多