Ubuntu/Linux Installation Command and Steps: Deadsnakes PPA
Ubuntu/Linux Installation Command and Steps: Deadsnakes PPA
Ubuntu/Linux Installation Command and Steps: Deadsnakes PPA
steps
This document describes how to install Python 3.6 or 3.8 on Ubuntu Linux machines.
To see which version of Python 3 you have installed, open a command prompt and run
$ python3 --version
If you are using Ubuntu 16.10 or newer, then you can easily install Python 3.6 with the
following commands:
If you’re using another version of Ubuntu (e.g. the latest LTS release) or you want to use
a more current Python, we recommend using the deadsnakes PPA to install Python 3.8:
If you are using other Linux distribution, chances are you already have Python 3 pre-
installed as well. If not, use your distribution’s package manager. For example on
Fedora, you would use dnf:
Note that if the version of the python3 package is not recent enough for you, there may
be ways of installing more recent versions as well, depending on you distribution. For
example installing the python3.9 package on Fedora 32 to get Python 3.9. If you are a
Fedora user, you might want to read about multiple Python versions available in Fedora.
Working with Python 3
At this point, you may have system Python 2.7 available as well.
$ python
$ python3
$ command -v pip
To install pip, follow the official pip installation guide - this will automatically install the
latest version of setuptools.
Note that on some Linux distributions including Ubuntu and Fedora the pip command
is meant for Python 2, while the pip3 command is meant for Python 3.
$ command -v pip3
However, when using virtual environments (described below), you don’t need to care
about that.
How to install virtualenv:
Install pip first
virtualenv venv
you can use any name insted of venv
source venv/bin/activate
source venv/bin/activate.fish
To deactivate:
deactivate
DONE! Just write “workon cv4” whenever you want to activate this
environment.
Basics
From the terminal, run the following commands to update packages and install some
essential software:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake g++ gfortran git vim pkg-config python-dev software-
properties-common wget
sudo apt-get autoremove
2- Once the module is installed we are ready to create virtual environments for Python 3.
Switch to the directory where you would like to store your Python 3 virtual environments. Within the
directory run the following command to create your new virtual environment:
python3 -m venv my-project-env
3- The command above creates a directory called my-project-env , which contains a copy of the
Python binary, the Pip package manager, the standard Python library and other supporting files.
To start using this virtual environment, you need to activate it by running the activate script:
source my-project-env/bin/activate
4- Once activated, the virtual environment’s bin directory will be added at the beginning of
the $PATH variable. Also your shell’s prompt will change and it will show the name of the virtual
environment you’re currently using. In our case that is my-project-env :
$ source my-project-env/bin/activate
(my-project-env) $
Now that the virtual environment is activated, we can start installing, upgrading,
and removing packages using pip.
Nvidia Drivers
You will need to download the correct driver based on your GPU model,
which you can check with the following command:
cat /proc/driver/nvidia/version
CUDA
Download the CUDA 8.0 toolkit from Nvidia’s site. Go to the Downloads
directory (or where ever you chose to save it) and install CUDA:
source ~/.bashrc
nvcc -V
Restart your computer:
Once created, you’ll see two files in your repository if you chose the licensing and README file.
Step 3: Configuring Git per User
After installing Git, configuration is needed for commit messages to be sent out. Without setting the
name and email address you’ll see warnings when making commitments to git. If you have multiple
user who utilize git, make an entry for each user. You can easily set these details for a user with two
commands within your server’s terminal. (If you need to access the information set you can find it in
the .gitconfig file.)
Note:
If you already have a github.com account you can use the associated username and email.
git config --global user.name "Your_Name"
git config --global user.email "email_address@domain.com"
In our next tutorial, where will teach you how to edit/create a file on your server and push the script to
your GitHub account.
Updated
4 min read
Pip is a package management system that simplifies installation and management of software
packages written in Python such as those found in the Python Package Index (PyPI). Pip is not
installed by default on Ubuntu 18.04, but the installation is pretty straightforward.
In this tutorial, we will show you how to install Python Pip on Ubuntu 18.04 using the apt package
manager. We will also walk you through the basics of installing and managing Python packages with
pip.
Prerequisites
Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges .
The command above will also install all the dependencies required for building Python
modules.
3. Once the installation is complete, verify the installation by checking the pip version:
pip3 --version
The version number may vary, but it will look something like this:
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)