Liwaiwai Liwaiwai
  • /
  • Artificial Intelligence
  • Machine Learning
  • Robotics
  • Engineering
    • Architecture
    • Design
    • Software
    • Hybrid Cloud
    • Data
  • About
Liwaiwai Liwaiwai
  • /
  • Artificial Intelligence
  • Machine Learning
  • Robotics
  • Engineering
    • Architecture
    • Design
    • Software
    • Hybrid Cloud
    • Data
  • About
  • Programming

How To: Configure Python Virtual Environment In Ubuntu

  • April 6, 2019
  • admin

Overview

This guide/article shows how to install, configure/create and use a Python Virtual environment.

Prerequisites

  • Operating System: Ubuntu 16 or greater
  • Python is installed. Python 3.X or 2.X.

Steps

Check that Python is available on the system. The Python version should be returned.

# If Python 2.x
$ python --version

# If Python 3.x
$ python3 --version

For the next steps, we will be using Python 3.7 for the sample, but should still be usable for Python 2.X.

01. Install Python Pip. Pip is a package manager for Python.

$ sudo apt-get update
$ sudo apt-get install python3-pip -y

 

02. Verify that Pip has been installed.

$ pip3 --version

 

03. Install the Python Virtual environment

$ sudo apt-get install python3-venv

 

04. Navigate to the directory on where to create the Virtual environment. In this example, we will be creating the virtual environment on the HOME directory.

$ cd ~

# FORMAT
$ python3 -m venv

# SAMPLE
$ python3 -m venv dotlah-python-venv

 

Note that this command will create a Virtual Environment that uses the current version of Python. Which is Python 3.7 in this example.

 

05. Activate the virtual environment.

$ cd ~
$ source dotlah-python-venv/bin/activate

 

06. If the terminal or shell has been prepend with the name of the virtual environment. Then the Virtual environment has been activated successfully.

 

Advantages

“Python applications will often use packages and modules that don’t come as part of the standard library. Applications will sometimes need a specific version of a library, because the application may require that a particular bug has been fixed or the application may be written using an obsolete version of the library’s interface.”

— https://docs.python.org

— Virtual environment helps isolate the dependencies of different projects separate from each other

Read More  PyCon 2019 | Pandas Is For Everyone

— Different applications can use different virtual environments with different python packages or libraries

— Different virtual environments can also be used for testing different versions of a Python package. Example is when migrating or upgrading from a lower version to a newer version. Checking if there will be incompatibilities with new version.

admin

Related Topics
  • How To
  • Programming
  • Python
  • Ubuntu
You May Also Like
View Post
  • Machine Learning
  • Programming
  • Software Engineering

10 Best Python Machine Learning Tutorials

  • February 14, 2023
View Post
  • Artificial Intelligence
  • Machine Learning
  • Programming
  • Public Cloud

How To Run A Large Scale ML Workflow On Dataflow ML For Autonomous Driving

  • November 19, 2022
View Post
  • Artificial Intelligence
  • Machine Learning
  • Programming

Machine Learning Experiments In Gaming And Why It Matters

  • November 3, 2022
View Post
  • Artificial Intelligence
  • Machine Learning
  • Programming
  • Public Cloud
  • Software Engineering

Building A Machine Learning Platform With Kubeflow And Ray On Google Kubernetes Engine

  • September 30, 2022
View Post
  • Programming

Scaling Heterogeneous Graph Sampling For GNNs With Google Cloud Dataflow

  • August 2, 2022
View Post
  • Machine Learning
  • Programming

Use R To Train And Deploy Machine Learning Models On Vertex AI

  • July 30, 2022
View Post
  • Artificial Intelligence
  • Programming
  • Public Cloud

Introducing Model Co-Hosting To Enable Resource Sharing Among Multiple Model Deployments On Vertex AI

  • July 15, 2022
View Post
  • Machine Learning
  • Programming

Doing Small Network Scientific Machine Learning In Julia 5x Faster Than PyTorch

  • July 15, 2022

Leave a Reply

Your email address will not be published. Required fields are marked *

Stay Connected!
LATEST
  • 1
    Unlocking The Secrets Of ChatGPT: Tips And Tricks For Optimizing Your AI Prompts
    • March 29, 2023
  • 2
    Try Bard And Share Your Feedback
    • March 29, 2023
  • 3
    Google Data Cloud & AI Summit : In Less Than 12 Hours From Now
    • March 29, 2023
  • 4
    Talking Cars: The Role Of Conversational AI In Shaping The Future Of Automobiles
    • March 28, 2023
  • 5
    Document AI Introduces Powerful New Custom Document Classifier To Automate Document Processing
    • March 28, 2023
  • 6
    How AI Can Improve Digital Security
    • March 27, 2023
  • 7
    ChatGPT 4.0 Finally Gets A Joke
    • March 27, 2023
  • 8
    Mr. Cooper Is Improving The Home-buyer Experience With AI And ML
    • March 24, 2023
  • 9
    My First Pull Request At Age 14
    • March 24, 2023
  • 10
    The 5 Podcasts To Check If You Want To Get Up To Speed On AI
    • March 24, 2023

about
About
Hello World!

We are liwaiwai.com. Created by programmers for programmers.

Our site aims to provide materials, guides, programming how-tos, and resources relating to artificial intelligence, machine learning and the likes.

We would like to hear from you.

If you have any questions, enquiries or would like to sponsor content, kindly reach out to us at:

[email protected]

Live long & prosper!
Most Popular
  • 1
    GPT-4 : The Latest Milestone From OpenAI
    • March 24, 2023
  • 2
    Ditching Google: The 3 Search Engines That Use AI To Give Results That Are Meaningful
    • March 23, 2023
  • 3
    Peacock: Tackling ML Challenges By Accelerating Skills
    • March 23, 2023
  • 4
    Coop Reduces Food Waste By Forecasting With Google’s AI And Data Cloud
    • March 23, 2023
  • 5
    Gods In The Machine? The Rise Of Artificial Intelligence May Result In New Religions
    • March 23, 2023
  • /
  • Artificial Intelligence
  • Machine Learning
  • Robotics
  • Engineering
  • About

Input your search keywords and press Enter.