如何在Amazon1EC2实例(Cloud9)上安装/配置python 3.7?

2024-09-28 13:17:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用AWS Cloud9 Amazon1(EC2)实例

Python 2.7是预安装的

我不确定Python3.7将安装在哪里-home dir还是root dir?有人可以帮助我安装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.

请注意apt-get不受支持yum有效

更新

我已经按照answer中的步骤成功安装了Python3.7,并通过触发python3.7 -V进行了检查。但是,依赖项检查器无法检测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

Tags: the实例awsdircheckercd步骤zip
3条回答

根据评论

AmazonLinux1上没有python 3.7的本机包。因此,它应该按照here所示进行编译。汇编步骤包括:

  1. 安装依赖项
yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel
  1. 下载python源代码:
cd /usr/src
wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
  1. 提取Python-3.7.9
tar xzf Python-3.7.9.tgz
  1. 汇编
cd Python-3.7.9
./configure  enable-optimizations
make altinstall
  1. 清理
rm /usr/src/Python-3.7.9.tgz

更新

需要sym link pyhton:

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

enter image description here

如果您是从控制台(web浏览器而不是CloudFormation)创建Cloud9环境,那么现在可以使用AmazonLinux2。它应该安装一套更为最新的工具

相关问题 更多 >

    热门问题