At the time of writing, the default Python installation on an EC2 instance running Amazon Linux AMI is Python 2.7 and can be found in
Installing Python 3 using
won’t work as Amazon Linux AMI does not support
Firstly, see what installation packages are available that could be a potential match
Then install the package wanted
which places the files in
so no need to change
Now that we have an up-to-date version of Python, let’s take a look at installing packages. The best way to do so is use a package called pip.
returns a concise overview of how the package works. This default installation is located in
The pip package can be updated via
and doing so appears to move the installation to
as the executable in
no longer works.
returns the packages installed by pip. The list shows that there are several pre-installed packages which are in
or something similar.
Where do installed packages get saved?
Let’s verify installed packages get saved in
does not work and neither does
The former is due to a permission error, the latter as the super user has a different path variable to
and thus cannot resolve the command
To get round this, either change the super user path variable or, more simply, specify the full path of the pip executable
To complete the verification,
Metadata-Version: 1.1 Name: pyprimes Version: 0.1 Summary: Generate and test for prime numbers. Home-page: http://pypi.python.org/pypi/pyprimes Author: Steven D'Aprano Author-email: [email protected] License: MIT Location: /usr/local/lib/python2.7/site-packages Requires:
In Part 2, we’ll take a look at the