Raspberry Pi - Upgrading to Python 3.6

From myWiki
Revision as of 17:39, 21 March 2020 by Stevet (talk | contribs) (Created page with " $ wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz $ tar xzvf Python-3.6.9.tgz $ cd Python-3.6.9/ $ ./configure && make && sudo make install It will take a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
$ wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
$ tar xzvf Python-3.6.9.tgz
$ cd Python-3.6.9/
$ ./configure && make && sudo make install

It will take a while to complete on a Raspberry Pi 3

Installing pip

# python3 -m pip install --user --upgrade pip

Check pip version

python3 -m pip --version

Installing virtual environment package

python3 -m pip install --user virtualenv

Create a virtual environment

python3 -m venv env

Activate virtual environment

source env/bin/activate

Deactivate virtual environment

deactivate

Install requests python package

pip3 install requests

Freezing pip dependencies

pip freeze

Using a file to control dependencies create a requirements.txt file containing:

requests==2.18.4
google-auth==1.1.0

And tell pip to install all of the packages in this file using the -r flag:

pip install -r requirements.txt

Upgrading packages with pip3

pip3 install --upgrade requests