Switch from python2.7 to python3.6 (centos7)

Python replacement memo in Centos7

# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)

# yum install -y https://centos7.iuscommunity.org/ius-release.rpm
# yum search python36
# yum install -y python36u python36u-libs python36u-devel python36u-pip

Symbolic link replacement
# ls -l /bin/py*
# ln -s /bin/python3.6 /bin/python3
# unlink /bin/python
# ln -s /bin/python3.6 /bin/python
# vim $(which pip)
The first line#!/usr/bin/python2   → #!/usr/bin/python
# pip --version
pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6)

If you are using awscli

# vim $(which aws)
The first line#!/usr/bin/python2   → #!/usr/bin/python

If you get the following error

# aws s3 ls
Traceback (most recent call last):
  File "/bin/aws", line 19, in <module>
    import awscli.clidriver
ModuleNotFoundError: No module named 'awscli'

install

# sudo pip install awscli

Postscript

yum also stops working.

# yum
  File "/bin/yum", line 30
    except KeyboardInterrupt, e:
                            ^
SyntaxError: invalid syntax

When it comes to python3, the print statement has changed to print (), The exception catch syntax has changed from (comma) to as. If you re-paste the link, you can use it normally. .. Hmm? What should I do

Recommended Posts

Switch from python2.7 to python3.6 (centos7)
Python to switch from another language
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Connecting from python to MySQL on CentOS 6.4
Introducing Python 2.7 to CentOS 6.6
Post from Python to Slack
Anaconda updated from 4.2.0 to 4.3.0 (python3.5 updated to python3.6)
Connect to sqlite from python
Switch python to 2.7 with alternatives
Call Matlab from Python to optimize
Create folders from '01' to '12' with python
Post from python to facebook timeline
[Lambda] [Python] Post to Twitter from Lambda!
Python (from first time to execution)
Post images from Python to Tumblr
How to access wikipedia from python
Did not change from Python 2 to 3
Update Python on Mac from 2 to 3
Connect to Packetix VPN from CentOS 7 minimal.
Updated to Python 2.7.9
Python2.7 + CentOS7 + OpenCV3
How to update Google Sheets from Python
Send a message from Python to Slack
Private Python handbook (updated from time to time)
I want to use jar from python
Switch Python versions
Convert from katakana to vowel kana [python]
Push notification from Python server to Android
Sum from 1 to 10
sql from python
Porting and modifying doublet-solver from python2 to python3.
How to switch mouse operations on CentOS
MeCab from Python
How to switch python versions in cloud9
Python> Output numbers from 1 to 100, 501 to 600> For csv
Convert from Markdown to HTML in Python
[Amazon Linux] Switching from Python 2 series to Python 3 series
API explanation to touch mastodon from python
CentOS8 --Install --Python3
Connect to coincheck's Websocket API from Python
"Backport" to python 2
How to install python3 with docker centos
Send a message from Slack to a Python server
Edit Excel from Python to create a PivotTable
How to open a web browser from python
Study from Python Hour7: How to use classes
[Python] Convert from DICOM to PNG or CSV
Import Excel file from Python (register to DB)
I want to email from Gmail using Python.
[Python] I want to manage 7DaysToDie from Discord! 1/3
From file to graph drawing in Python. Elementary elementary
[Python] How to read data from CIFAR-10 and CIFAR-100
[python] Create table from pandas DataFrame to postgres
[Remotte Development] Switch from administrator mode to developer mode
[Bash] Use here-documents to get python power from bash
How to generate a Python object from JSON
How to handle Linux commands well from Python
I want to use ceres solver from python
What I did when updating from Python 2.6 to 2.7
[Python] I want to manage 7DaysToDie from Discord! 2/3