Skip to content

Instantly share code, notes, and snippets.

@094459
Created September 4, 2023 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 094459/3eba3e5f4fb1ccaef1cb12044412f90b to your computer and use it in GitHub Desktop.
Save 094459/3eba3e5f4fb1ccaef1cb12044412f90b to your computer and use it in GitHub Desktop.
Quick script to enable Python 3.10.11 on AWS Cloud9
#!/bin/sh
# Thanks to https://stackoverflow.com/questions/71954694/pyenv-on-amazon-linux-fails-to-build-due-to-openssl
# and https://gist.github.com/djohnkang/062e1b5c37df7d4d5b4e503315481282
# Save this as a bash script in your AWS Cloud9 environment, and then run it. After it runs, you should now have Python 3.10.11 available
sudo yum remove openssl-devel.x86_64 -y
sudo yum autoremove -y
sudo yum install gcc zlib-devel bzip2 bzip2-devel readline readline-devel sqlite sqlite-devel opensll openssl11-devel libffi-devel xz-devel -y
# sudo yum groupinstall "Development Tools" -y && sudo yum install -y zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel tk-devel libffi-devel xz-devel
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
. ~/.bashrc
pyenv install 3.10.11
pyenv global 3.10.11
python -V
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
. ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment