[Amazon Linux] Switching from Python 2 series to Python 3 series


AMI: Amazon Linux AMI 2018.03.0 (HVM), SSD Volume Type


   $  sudo yum install python36
   $  python3 --version
   $  sudo yum install git
   $  git clone git://github.com/yyuu/pyenv.git ~/.pyenv
   $  emacs ~/.bash_profile
   $  source ~/.bash_profile
   $  sudo yum install zlib1g-dev
   $  sudo yum install libssl-dev
   $  sudo yum install gcc zlib-devel bzip2 bzip2-devel readline readline-devel sqlite sqlite-devel openssl openssl-devel -y
   $  pyenv install 3.6.8
   $  pyenv global 3.6.8
   $  pyenv rehash
   $  python --version


# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc

# User specific environment and startup programs
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

Confirmation method

$ python --version

It should be okay if the execution result of is 3 system

Reference site

Installing Python on Linux Switch Python from 2 to 3 !! Building Python3 environment on EC2 server

I also summarized it on my blog, so thank you.

[Amazon Linux] Command to switch from Python 2 series to Python 3 series

Recommended Posts

[Amazon Linux] Switching from Python 2 series to Python 3 series
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
How to handle Linux commands well from Python
Data integration from Python app on Linux to Amazon Redshift with ODBC
Post from Python to Slack
Cheating from PHP to Python
Switch from python2.7 to python3.6 (centos7)
Connect to sqlite from python
How to build a Python environment on amazon linux 2
Query from python to Amazon Athena (using named profile)
[Amazon Linux 2] Change from public key authentication to password authentication
ODBC access to SQL Server from Linux with Python
Install Python Pillow on Amazon Linux
Create folders from '01' to '12' with python
[Lambda] [Python] Post to Twitter from Lambda!
How to install wkhtmltopdf (Amazon Linux2)
Connect to utf8mb4 database from python
Python (from first time to execution)
Post images from Python to Tumblr
Introducing Amplify to Amazon Linux 2 AMI
How to access wikipedia from python
Python to switch from another language
Introduce Python 3.5.2 environment on Amazon Linux
Try using Amazon DynamoDB from Python
Did not change from Python 2 to 3
Update Python on Mac from 2 to 3
Terminal association from the server side to Amazon SNS (python + boto3)
[Python] Fluid simulation: From linear to non-linear
Building a Python3 environment with Amazon Linux2
From Python to using MeCab (and CaboCha)
[Linux] Flow from power-on to PC startup
How to update Google Sheets from Python
Send a message from Python to Slack
I want to use jar from python
How to update php on Amazon linux 2
Connecting from python to MySQL on CentOS 6.4
Upgraded mysql on Cloud9 (Amazon Linux) (5.5 to 5,7)
How to access RDS from Lambda (python)
How to install Anisble on Amazon Linux 2
How to operate Linux from the console
Python> Output numbers from 1 to 100, 501 to 600> For csv
Introducing Docker Engine to Linux From Scratch
Convert from Markdown to HTML in Python
API explanation to touch mastodon from python
Adding Series to columns in python pandas
Install Python 3.8, Pip 3.8 on EC2 (Amazon Linux 2)
Connect to coincheck's Websocket API from Python
Data integration from Python app on Windows to Amazon Redshift with ODBC
Copy data from Amazon S3 to Google Cloud Storage with Python (boto)
Send a message from Slack to a Python server
Get time series data from k-db.com in Python
Edit Excel from Python to create a PivotTable
Updated to Python 2.7.9
How to open a web browser from python
Easy script migration from CentOS to Oracle Linux
Study from Python Hour7: How to use classes
[Python] Convert from DICOM to PNG or CSV
Import Excel file from Python (register to DB)
How to use Python Image Library in python3 series
I want to email from Gmail using Python.