dotlah! dotlah!
  • Cities
  • Technology
  • Business
  • Politics
  • Society
  • Science
  • About
Social Links
  • zedreviews.com
  • citi.io
  • aster.cloud
  • liwaiwai.com
  • guzz.co.uk
  • atinatin.com
0 Likes
0 Followers
0 Subscribers
dotlah!
  • Cities
  • Technology
  • Business
  • Politics
  • Society
  • Science
  • About
  • Technology

How To: Configure Python Virtual Environment In Ubuntu

  • April 6, 2019
Total
0
Shares
0
0
0

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

— 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.

Total
0
Shares
Share
Tweet
Share
Share
Related Topics
  • How To
  • Programming
  • Python
  • Ubuntu
majulah

Previous Article
  • Cities
  • Lah!

An Easier Way To Travel With SimplyGo

  • April 4, 2019
View Post
Next Article
  • Technology

How To: Create A Flask/API Project In Ubuntu

  • April 6, 2019
View Post
You May Also Like
View Post
  • Technology

Tech predictions for 2027 and beyond

  • dotlah.com
  • November 25, 2026
View Post
  • Artificial Intelligence
  • Technology

Google Opens Singapore Engineering Center to Build and Export Enterprise Cloud and AI to the World

  • Dean Marc
  • September 15, 2026
View Post
  • Research
  • Technology

MIT researchers tackle the economic realities of fusion power

  • dotlah.com
  • August 10, 2026
zedreviews-valerion
View Post
  • Gears
  • Technology

Father’s Day Outdoors – Build Dad the Ultimate Backyard Watch Party

  • Dean Marc
  • June 21, 2026
zedreviews-fathers-day-50830
View Post
  • Gears
  • Technology

Father’s Day Outdoors, Round Two – Gear for the Action, the Tailgate, and Beating the Heat

  • Dean Marc
  • June 21, 2026
zedreviews-fathers-day-21306
View Post
  • Gears
  • Technology

A Father’s Day Gift Guide for Every Dad – Timepieces and Travel Gear

  • Dean Marc
  • June 21, 2026
View Post
  • Gears
  • Technology

Samsung Art Store Brings Art Basel to Homes Worldwide With New Curated Collection

  • Dean Marc
  • June 15, 2026
View Post
  • Artificial Intelligence
  • Technology

The consequences of relying on AI for accurate news

  • dotlah.com
  • June 10, 2026


Trending
  • 1
    • Society
    Toilet Paper Companies Sees Revenue Spike As Consumers Resort To Panic Buying
    • April 29, 2020
  • 2
    • Economy
    • People
    • World Events
    Prioritizing Health: A Prescription For Prosperity
    • July 17, 2020
  • 3
    • Environment
    • People
    Hurricanes And Wildfires Are Colliding With The COVID-19 Pandemic – And Compounding The Risks
    • August 28, 2020
  • 4
    • Science
    • Society
    When Will There Be A Coronavirus Vaccine? 5 Questions Answered
    • January 29, 2020
  • 5
    • Cities
    • Scapes
    Top Free Things To Do In London
    • August 10, 2020
  • college-of-cardinals-2025 6
    • Featured
    • Features
    • World Events
    The Definitive Who’s Who of the 2025 Papal Conclave
    • May 8, 2025
  • 7
    • People
    • Politics
    • World Events
    Why Divine Immanence Mattered For The Civil Rights Struggle
    • August 28, 2020
  • 8
    • Technology
    Enabling Data-Driven Innovation Through Trusted Data Sharing In A Digital Economy
    • June 28, 2019
  • 9
    • Technology
    Innovating With AI: 5 Steps To Soar
    • January 28, 2020
  • 10
    • Cities
    • Society
    How The Coronavirus Market Turmoil Compares To 2008 – And What We Can Do
    • March 14, 2020
  • 11
    • People
    • World Events
    COVID-19: Social Distancing Is Triggering Another Crisis We Must Prevent
    • April 21, 2020
  • 12
    • Lah!
    Singapore Continues To Invest In Infrastructure, Partnerships And Innovation To Boost Our Digital Economy
    • October 17, 2019
Trending
  • 1
    Google achieves approval for NATO restricted workloads across cloud and AI services
    • December 4, 2026
  • 2
    Tech predictions for 2027 and beyond
    • November 25, 2026
  • 3
    Apple unveils groundbreaking MacBook Pro with PROLED XDR Display and Touch for the first time on Mac
    • October 28, 2026
  • 4
    Apple introduces the new 14‑inch MacBook Pro with M6
    • October 27, 2026
  • 5
    Apple unveils new iMac with M6, delivering a major boost in performance and AI capabilities
    • October 27, 2026
  • 6
    Chinese tech giant Huawei unveils Mate 90 series smartphones with flagship Tau chips adopting logic folding technology
    • October 3, 2026
  • 7
    Google Opens Singapore Engineering Center to Build and Export Enterprise Cloud and AI to the World
    • September 15, 2026
  • 8
    Apple Flagship Hardware Launch for September 2026
    • September 10, 2026
  • 9
    MIT researchers tackle the economic realities of fusion power
    • August 10, 2026
  • 10
    ASEAN, treaty parties push stronger cooperation as Treaty of Amity and Cooperation in Southeast Asia marks 50 years
    • July 26, 2026
Social Links
dotlah! dotlah!
  • Cities
  • Technology
  • Business
  • Politics
  • Society
  • Science
  • About
Connecting Dots Across Asia's Tech and Urban Landscape

Input your search keywords and press Enter.