简体   繁体   中英

How to install/configure python 3.7 on Amazon1 EC2 instance (Cloud9)?

I am using AWS Cloud9 Amazon1 (EC2) instance.

Python 2.7 is pre-installed.

I am not sure where the python 3.7 is to be installed - home dir or root dir? Can someone help me with the steps to install python 3.7 such that it meets the following criteria:

If Python 3.7 is installed on the device, name the binary 'python3.7' and add its parent directory to the PATH environment variable.

Note that apt-get is not supported. yum works.

Update :

I have followed the steps from answer and installed python 3.7 successfully and checked by firing python3.7 -V . However, the dependency checker is unable to detect the python 3.7:

mkdir greengrass-dependency-checker-GGCv1.11.x
cd greengrass-dependency-checker-GGCv1.11.x
wget https://github.com/aws-samples/aws-greengrass-samples/raw/master/greengrass-dependency-checker-GGCv1.11.x.zip
unzip greengrass-dependency-checker-GGCv1.11.x.zip
cd greengrass-dependency-checker-GGCv1.11.x
sudo ./check_ggc_dependencies | more

Based on the comments.

There is no native package for python 3.7 on Amazon Linux 1. Thus, it should be compiled as shown here . The compilation steps include:

  1. Installation of dependencies,
yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel
  1. Downloading python source:
cd /usr/src
wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
  1. Extract Python-3.7.9
tar xzf Python-3.7.9.tgz
  1. Compilation
cd Python-3.7.9
./configure --enable-optimizations
make altinstall
  1. Cleanup
rm /usr/src/Python-3.7.9.tgz

Update

Need to sym link pyhton:

ln -s /usr/local/bin/python3.7 /usr/bin/python3.7

在此处输入图像描述

You will most likely have to either:

If you're creating the Cloud9 environment from the console (web browser instead of CloudFormation) then you can now use Amazon Linux 2. That should have a more up to date set of tools installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM