[英]How to install/configure python 3.7 on Amazon1 EC2 instance (Cloud9)?
I am using AWS Cloud9 Amazon1 (EC2) instance.我正在使用 AWS Cloud9 Amazon1 (EC2) 实例。
Python 2.7 is pre-installed. Python 2.7 已预装。
I am not sure where the python 3.7 is to be installed - home dir or root dir?我不确定 python 3.7 的安装位置 - 主目录还是根目录? Can someone help me with the steps to install python 3.7 such that it meets the following criteria:
有人可以帮助我安装 python 3.7 的步骤,使其满足以下条件:
If Python 3.7 is installed on the device, name the binary 'python3.7' and add its parent directory to the PATH environment variable.
如果设备上安装了 Python 3.7,请将二进制文件命名为“python3.7”并将其父目录添加到 PATH 环境变量中。
Note that apt-get
is not supported.请注意,不支持
apt-get
。 yum
works. yum
作品。
Update :更新:
I have followed the steps from answer and installed python 3.7 successfully and checked by firing python3.7 -V
.我已经按照答案中的步骤成功安装了 python 3.7 并通过触发
python3.7 -V
进行了检查。 However, the dependency checker is unable to detect the python 3.7:但是,依赖项检查器无法检测到 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 . Amazon Linux 1 上没有 python 3.7 的原生 package 1。因此,应该按此处所示进行编译。 The compilation steps include:
编译步骤包括:
yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel
cd /usr/src
wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
tar xzf Python-3.7.9.tgz
cd Python-3.7.9
./configure --enable-optimizations
make altinstall
rm /usr/src/Python-3.7.9.tgz
Need to sym link pyhton:需要 sym 链接 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.如果您从控制台(Web 浏览器而不是 CloudFormation)创建 Cloud9 环境,那么您现在可以使用 Amazon Linux 2。这应该安装了一组更新的工具。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.