在 RHEL 上安装 Python 3 [英] Installing Python 3 on RHEL

查看:52
本文介绍了在 RHEL 上安装 Python 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下步骤在 RHEL 上安装 python3:

I'm trying to install python3 on RHEL using the following steps:

yum search python3

返回找不到匹配项:python3

关注:

yum search python

没有一个搜索结果包含 python3.接下来我应该尝试什么?

None of the search results contained python3. What should I try next?

推荐答案

手动安装很容易:

  1. 下载(Python.org 上可能有更新的版本):

  1. Download (there may be newer releases on Python.org):

$ wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz

  • 解压

  • Unzip

    $ tar xf Python-3.* 
    $ cd Python-3.*
    

  • 准备编译

  • Prepare compilation

    $ ./configure
    

  • 构建

  • Build

    $ make
    

  • 安装

  • Install

    $ make install
    

    或者,如果您不想覆盖 python 可执行文件(更安全,至少在某些发行版上 yum 需要 python 为 2.x,例如 RHEL6) - 您可以使用 altinstallpython3.* 作为并发实例安装到系统默认:

    OR if you don't want to overwrite the python executable (safer, at least on some distros yum needs python to be 2.x, such as for RHEL6) - you can install python3.* as a concurrent instance to the system default with an altinstall:

    $ make altinstall
    

  • 现在如果你想要一个替代的安装目录,你可以将 --prefix 传递给 configure 命令.

    Now if you want an alternative installation directory, you can pass --prefix to the configurecommand.

    示例:要在/opt/local 中安装"Python,只需添加 --prefix=/opt/local.

    Example: for 'installing' Python in /opt/local, just add --prefix=/opt/local.

    make install 步骤之后:为了使用新的 Python 安装,您可能仍然需要将 [prefix]/bin 添加到 $PATH 和 [prefix]/lib 到 $LD_LIBRARY_PATH(取决于您传递的 --prefix)

    After the make install step: In order to use your new Python installation, it could be, that you still have to add the [prefix]/bin to the $PATH and [prefix]/lib to the $LD_LIBRARY_PATH (depending of the --prefix you passed)

    这篇关于在 RHEL 上安装 Python 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆