如何在AWS EC2实例上安装Python 3.6。

huangapple go评论86阅读模式
英文:

How to install python3.6 on aws ec2 instance

问题

这个问题是关于安装 Python 3.6 版本的,不是其他版本。

我正在使用 AWS 的 amazonlinux Docker 镜像,并尝试在其中安装 Python 3.6。不到一个月前,只需使用 yum install python3.x86_64 就可以了,但现在似乎所有的 Python 3 版本都在使用 Python 3.7,如下所示:

bash-4.2# sudo yum list | grep python3
python3.i686                           3.7.4-1.amzn2.0.3              amzn2-core
python3.x86_64                         3.7.4-1.amzn2.0.3              amzn2-core
python3-Cython.x86_64                  0.27.3-2.amzn2.0.2             amzn2-core
python3-debug.x86_64                   3.7.4-1.amzn2.0.3              amzn2-core
python3-devel.x86_64                   3.7.4-1.amzn2.0.3              amzn2-core
python3-libs.i686                      3.7.4-1.amzn2.0.3              amzn2-core
python3-libs.x86_64                    3.7.4-1.amzn2.0.3              amzn2-core
python3-lit.noarch                     0.7.1-1.amzn2.0.1              amzn2-core
python3-openmpi.x86_64                 4.0.1-11.amzn2.0.1             amzn2-core
python3-pip.noarch                     9.0.3-1.amzn2.0.1              amzn2-core
python3-rpm.x86_64                     4.11.3-40.amzn2.0.3            amzn2-core
python3-rpm-macros.noarch              3-23.amzn2                     amzn2-core
python3-setuptools.noarch              38.4.0-3.amzn2.0.6             amzn2-core
python3-test.x86_64                    3.7.4-1.amzn2.0.3              amzn2-core
python3-tkinter.x86_64                 3.7.4-1.amzn2.0.3              amzn2-core
python3-tools.x86_64                   3.7.4-1.amzn2.0.3              amzn2-core
python3-wheel.noarch                   0.30.0a0-9.amzn2.0.3           amzn2-core
英文:

This question is specifically for installing version 3.6 of python. Not any other versions.

I'm using aws' amazonlinux docker image and trying to install python3.6 on it. It worked less than a month ago simply using yum install python3.x86_64, but now it seems that all python3 versions are using python3.7 as shown below:


bash-4.2# sudo yum list | grep python3 
python3.i686                           3.7.4-1.amzn2.0.3              amzn2-core
python3.x86_64                         3.7.4-1.amzn2.0.3              amzn2-core
python3-Cython.x86_64                  0.27.3-2.amzn2.0.2             amzn2-core
python3-debug.x86_64                   3.7.4-1.amzn2.0.3              amzn2-core
python3-devel.x86_64                   3.7.4-1.amzn2.0.3              amzn2-core
python3-libs.i686                      3.7.4-1.amzn2.0.3              amzn2-core
python3-libs.x86_64                    3.7.4-1.amzn2.0.3              amzn2-core
python3-lit.noarch                     0.7.1-1.amzn2.0.1              amzn2-core
python3-openmpi.x86_64                 4.0.1-11.amzn2.0.1             amzn2-core
python3-pip.noarch                     9.0.3-1.amzn2.0.1              amzn2-core
python3-rpm.x86_64                     4.11.3-40.amzn2.0.3            amzn2-core
python3-rpm-macros.noarch              3-23.amzn2                     amzn2-core
python3-setuptools.noarch              38.4.0-3.amzn2.0.6             amzn2-core
python3-test.x86_64                    3.7.4-1.amzn2.0.3              amzn2-core
python3-tkinter.x86_64                 3.7.4-1.amzn2.0.3              amzn2-core
python3-tools.x86_64                   3.7.4-1.amzn2.0.3              amzn2-core
python3-wheel.noarch                   0.30.0a0-9.amzn2.0.3           amzn2-core

答案1

得分: 1

你只需从源代码下载并构建。

步骤如下:

  1. 安装gcc和sqlite-devel:yum install gcc sqlite-devel
  2. 解压下载的存档并切换到目录
  3. 使用./configure --enable-optimizations进行配置
  4. 最后运行make altinstall

altinstall避免替换默认的/usr/bin/python

就这样!

英文:

You can just download and build from source.

The steps are as follows:

  1. Install gcc and sqlite-devel yum install gcc sqlite-devel
  2. Extract the downloaded archive and cd to the directory
  3. Configure with ./configure --enable-optimizations
  4. And finally make altinstall.

altinstall avoid replacing the default /usr/bin/python.

That's it!

答案2

得分: 1

请启用ius仓库并安装python36u。

https://www.certdepot.net/rhel7-how-to-install-the-ius-community-repository/

yum install python36u

英文:

Please enable ius repository and install python36u

https://www.certdepot.net/rhel7-how-to-install-the-ius-community-repository/

yum install python36u

huangapple
  • 本文由 发表于 2020年1月4日 01:21:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/59582741.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定