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
    • Cities
    • World Events
    COVID-19: Which Economies Are Reopening
    • June 8, 2020
  • data protection hacking 2
    • People
    • Technology
    Are Background Checks An Invasion Of Privacy?
    • January 21, 2021
  • 3
    • Science
    Black Holes Are Simpler Than Forests And Science Has Its Limits
    • August 23, 2019
  • Error 503 page layout vector design. Website 503 page unavailable creative concept. Http 503 page (service is unavailable) creative design. Modern 503 page not found concept. 4
    • Cities
    • Technology
    Fastly Global Internet Outage: Why Did So Many Sites Go Down — And What Is A CDN, Anyway?
    • June 9, 2021
  • 5
    • Technology
    Hungry For Data, Starving The World
    • November 22, 2019
  • 6
    • Cities
    • People
    What Do Smart Cities Mean For Healthcare And Nursing?
    • March 11, 2020
  • train-rail-lucas-gallone-C_wAF4c9cfE-unsplash 7
    • Cities
    How Future Trains Could Be Less Noisy
    • September 1, 2021
  • 8
    • Cities
    Natural Ways Of Cooling Cities
    • October 2, 2019
  • cemetery cross 9
    • People
    How To Move On After Losing A Loved One
    • November 19, 2020
  • 10
    • Lah!
    Sunseap’s Solar Capacity In Singapore Crosses 300 MWp Milestone
    • May 9, 2020
  • 11
    • Society
    DBS Makes Bloomberg Gender-Equality Index (GEI) For Third Year Running
    • January 23, 2020
  • thanksgiving-turkey-claudio-schwarz-fXxsNyiqTio-unsplash 12
    • Cities
    Will Supply Chain Troubles Ruin Your Thanksgiving?
    • November 18, 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.