How to install python3.11 on Amazon Cloud9 IDE? and make the IDE's Pylint module recognize Python's new feature/keywords, such as "match"?
Is there any simpler solutions?
I have found a solution with following steps:
Step One: install python3.11
sudo yum update -y
sudo yum erase openssl-devel -y
sudo yum install openssl11 openssl11-devel libffi-devel bzip2-devel wget -y
wget https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz
tar -xf Python-3.11.4.tgz
cd Python-3.11.4/
./configure --prefix=/usr --enable-optimizations
make -j $(nproc)
sudo make altinstall
python3.11 -V
NOTE: make -j $(nproc) This command will take a long time to complete. Please be patient.
Step Two: install pip
sudo yum install python3-pip
Step Three: install pylint
sudo yum makecache
sudo yum -y install pylint
Step Four: Switch python3 from python3.x to python3.11
sudo ln -sf /usr/bin/python3.11 /usr/bin/python3
NOTE: The path might be different.
Congratulations! Python3.11 is installed.
Let's test it
In the IDE create a file test.py with two lines of code
import sys
print (sys.version)
On the menu bar, click Run > Run With > Python 3, then python version will show, such as:
3.11.4
Step Five: Give the IDE a new Pylint
Now we need to get the Pylint working too, for proper error checking.
Open the pylint file.
vi ~/.c9/python3/bin/pylint
Change the very first line to following
#!/usr/bin/python3.11
NOTE: The path of python3.11 might be different
And save
Sometimes it won’t take effect immediately, just close all the tabs(files) on the IDE and reopen again.
Congratulations, Again! All done
let's try python’s new match pattern feature
def color(color):
match color:
case "red":
print("I am red")
case "blue":
print("I am blue")
case _:
print("I am blank")
color("red")
color("blue")
color("love")