How to use #python 3.6 on Cloud9 ide? #aws #cloud9 #awsMobile

By Jun - Support me on Amazon

As of Sep 2018, if you create a new Python project using aws CodeStar and choose to use Cloud9 as your ide, the default python in the path is Python 2.7.

How to change to Python 3.6

1) Change where python points to in bashrc.
Open a terminal tab >
in terminal, type in command `ls -la ~` >
in terminal, type in command `vim ~/.bashrc` >
.bashrc will be opened >
type in command `/python` to search if there is python alias already >
change / add in this line in .bashrc `alias python=python36` >
press Esc and type in command `:wq` to tell vim to write and quit the .bashrc file >
in terminal, type in command `source ~/.bashrc` OR open another terminal >
in terminal, type in command `python` >
python interactive shell will be python 3.6.5

Cloud9 python3.6 interactive shell

2 To let cloud9 ide knows that python3.6 is being used, you have to change python version in cloud9 preferences.

on the top menu, click AWS Cloud9 >
Preferences (cmd , shortcut) >
Select Python support on the left >
Change Python version to Python 3

AWS Cloud9 Preferences Menu

AWS Cloud9 Python Support

How to import urllib in python3? 

This seems to be a common question. I have seen it being asked in aws forums several times.
Here is how you import urllib in python3:

from urllib.parse import parse_qs
from urllib.parse import urlparse


import urllib.parse
import urllib.request


1) What is bashrc?
Bashrc is a shell script that is run when you open up a terminal.
Check out this bashrc stackexchange thread for more information about what bashrc is. 

Thanks for reading!