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
  • 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
pope-leo-xiv-cq5dam-1500.844
View Post
  • Artificial Intelligence
  • Technology

Pope Leo XIV to Publish First Encyclical on Artificial Intelligence and Human Dignity on 25 May

  • dotlah.com
  • May 23, 2026


Trending
  • 1
    • Lah!
    NTU Ranked Top 10 globally In 10 Subjects By Shanghai Ranking
    • May 27, 2021
  • 2
    • People
    Singapore’s national identity excludes those who don’t look like a ‘regular family’
    • October 9, 2025
  • 3
    • Cities
    The 100 Most Solar Cities In America
    • March 6, 2020
  • richest-person-2023 4
    • Economy
    • People
    The World’s Richest People in 2023
    • April 6, 2023
  • 5
    • Cities
    • Lah!
    Changi Airport In focus As East Coast GRC Grassroots Organisations And Advisors Acknowledge Aviation Frontliners
    • August 31, 2021
  • 6
    • Lah!
    • Science
    • Technology
    5 Space Tech Startups In SEA Paving The Way Beyond
    • May 2, 2020
  • 7
    • People
    Want To Know Your Real Origin? Here’s How To Do Proper Research
    • July 7, 2020
  • 8
    • Cities
    • Environment
    • People
    Is Your City Making You Fat? How Urban Planning Can Address The Obesity Epidemic
    • February 24, 2020
  • 9
    • Features
    • People
    Effective Ways For Teaching Children With Autism
    • August 8, 2020
  • 10
    • Cities
    Grab Singapore Announces Transport Sustainability Goal As Part Of Its GrabForGood Initiative; Aims For A Full Fleet Running On Cleaner Energy By 2030
    • July 8, 2021
  • 11
    • Cities
    • Lah!
    Towards A Safer Journey Through Changi Airport
    • July 2, 2020
  • 12
    • Lah!
    • Technology
    NTU Singapore Scientists Develop Device To ‘Communicate’ With Plants Using Electrical Signals
    • March 17, 2021
Trending
  • 1
    Chinese tech giant Huawei unveils Mate 90 series smartphones with flagship Tau chips adopting logic folding technology
    • October 3, 2026
  • 2
    Google Opens Singapore Engineering Center to Build and Export Enterprise Cloud and AI to the World
    • September 15, 2026
  • 3
    Apple Flagship Hardware Launch for September 2026
    • September 10, 2026
  • 4
    MIT researchers tackle the economic realities of fusion power
    • August 10, 2026
  • 5
    ASEAN, treaty parties push stronger cooperation as Treaty of Amity and Cooperation in Southeast Asia marks 50 years
    • July 26, 2026
  • 6
    The Fastest AI Fried Chicken In The World
    • June 29, 2026
  • 7
    Zed Approves | How to Stay Cool in Extreme Heat
    • June 29, 2026
  • 8
    Was Venezuela struck by an earthquake ‘doublet’? Here’s what we know so far
    • June 27, 2026
  • 9
    Zed Approves | It’s Prime Day 2026! Time to Upgrade Your World Cup Viewing Setup and Beat the Heat
    • June 25, 2026
  • 10
    Zed Approves | The Best Prime Day PC Deals: Top Gaming Rigs, Workstations, and Everyday Laptops
    • June 25, 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.