简体   繁体   English

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

[英]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:编译步骤包括:

  1. Installation of dependencies,安装依赖项,
yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel
  1. Downloading python source:下载python源码:
cd /usr/src
wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
  1. Extract Python-3.7.9提取 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:需要 sym 链接 pyhton:

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

在此处输入图像描述

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.

相关问题 如何限制 Amazon EC2 实例访问? - How to Restrict Amazon EC2 instance access? 如何在 Amazon EC2 实例上增加 ulimit? - How to increase ulimit on Amazon EC2 instance? 将 EC2 实例作为工作程序添加到 Amazon MWAA - Add an EC2 instance as a worker to Amazon MWAA 如何在 AWS EC2 实例上安装 apt-get? - How to install apt-get on AWS EC2 instance? 无法获取 Amazon EC2 实例 ID - Failed to get Amazon EC2 instance ID 如何在没有提示的情况下在没有交互的情况下自动在 Amazon AWS EC2 上运行 aws configure? - How to run aws configure on Amazon AWS EC2 automatically without interaction without prompt? 为什么在 VS Code 中使用 SSM 代理连接到 AWS Cloud9 EC2 实例时,我通过 SSH 的远程连接不起作用? - Why won't my remote connection through SSH work when using an SSM proxy to connect to AWS Cloud9 EC2 instance in VS Code? 是否可以使用云形成在未过时的 EC2 映像上部署 Cloud9 ide? - Is it possible to use cloud formation to deploy a Cloud9 ide on an EC2 image that is not obsolete? 如何使用 terraform 在 EC2 实例中选择性地配置 root_block_device - How to optionally configure root_block_device in EC2 instance using terraform Amazon EC2 实例:服务器拒绝了我们的密钥 - Amazon EC2 instance: Server refused our key
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM