Skip to content

Running code using virtual enviroment

Walter Hugo Lopez Pinaya edited this page Dec 31, 2019 · 2 revisions

System requirements

  • pip 19.0 or later
  • Ubuntu 16.04 or later (64-bit)

1. Install the Python development environment on your system

Check if your Python environment is already configured:

$ python3 --version
$ pip3 --version
$ virtualenv --version

If these packages are already installed, skip to the next step. Otherwise, install Python, the pip package manager, and Virtualenv:

$ sudo apt update
$ sudo apt install python3-dev python3-pip
$ sudo pip3 install -U virtualenv  # system-wide install

2. Create a virtual environment (recommended)

Python virtual environments are used to isolate package installation from the system.

Create a new virtual environment by choosing a Python interpreter and making a ./venv directory to hold it:

$ virtualenv --system-site-packages -p python3 ./venv

Activate the virtual environment using a shell-specific command:

$ source ./venv/bin/activate  # sh, bash, ksh, or zsh

When virtualenv is active, your shell prompt is prefixed with (venv).

Install packages within a virtual environment without affecting the host system setup. Start by upgrading pip:

(venv) $ pip install --upgrade pip
(venv) $ pip list  # show packages installed within the virtual environment

And to exit virtualenv later:

(venv) $ deactivate

3. Cloning repository

4. Installing dependencies

5. Running study scripts

Note: Step-by-step based on https://www.tensorflow.org/install/pip?lang=python3

Clone this wiki locally