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
    Vietnam Has Reported No Coronavirus Deaths – How?
    • April 24, 2020
  • 2
    • Cities
    • Lah!
    Changi Airport In focus As East Coast GRC Grassroots Organisations And Advisors Acknowledge Aviation Frontliners
    • August 31, 2021
  • covid19 testing 3
    • People
    • World Events
    New Report Gives Covid-19 Testing Strategies To Help America’s Communities Open Safely
    • September 28, 2020
  • 4
    • Lah!
    • Technology
    Deloitte And NTU Singapore Launch New Course In Audit Analytics To Build Capabilities In Accountants Of The Future
    • June 9, 2020
  • 5
    • Technology
    The Dream Of Living On Other Worlds
    • July 15, 2019
  • 6
    • Lah!
    We’re In Danger Of Drowning In A Coronavirus ‘Infodemic’. Here’s How We Can Cut Through The Noise
    • February 13, 2020
  • 7
    • Gears
    Apple debuts iPhone 17
    • September 9, 2025
  • 8
    • Society
    A Toilet Paper Run Is Like A Bank Run. The Economic Fixes Are About The Same
    • March 6, 2020
  • 9
    • Cities
    GreenGov.SG Movement Sets New Measures And Targets To Cut Carbon Emissions Across Public Sector
    • July 13, 2021
  • hp3-harry-potter-wallpaper_desktop_768x1024-v2 10
    • Cities
    Software. The Modern Philosopher’s Stone. Transmuting Imagination Into Capital.
    • June 27, 2023
  • 11
    • Cities
    Don’t Feel Like Taking Public Transport? Try These Next-Level Ways To Get Around The City
    • July 14, 2020
  • 12
    • Cities
    • Lah!
    Singapore Retains Top Spot Amongst World Maritime Centres For The Eighth Consecutive Year
    • July 13, 2021
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.