问题

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

yum search python3

其中返回了找不到匹配项:python3

其次:

yum search python

搜索结果中没有包含python3.我应该尝试下一步?



解决方法

可以轻松地手动安装:

  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
    
  2. Unzip

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

    $ ./configure
    
  4. Build

    $ make
    
  5. Install

    $ make install
    

    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 命令.

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

之后的 make install 步骤:为了使用你的新Python安装,可能是,你仍然必须添加[前缀] / bin到 $ PATH <代码>和[prefix] / lib到 $ LD_LIBRARY_PATH (取决于你传递的 - prefix )




相关问题推荐