DEV Community

petercour
petercour

Posted on

1 1

Virtual environments in Python

Python installs modules system wide. This is unlike other programming languages where you need to import modules.

System wide installs of modules can create conflicts, you want virtual environments.

on Ubuntu Linux

Setup virtual environment
On Ubuntu 18.x:

sudo apt-get install python3-venv

On other systems, you need another command to install. It's highly likely its installed by default on Mac and Windows.

Create Virtual Environment

Create Virtual Environment in the command line.
To create a new virtual environment:

python3.6 -m venv test

or

pyvenv test

Activate Virtual Environment

After creation, you need to activate virtual environment.
To activate the virutal environment

cd venv
source bin/activate

Then modules are only installed in the virtual environment, not conflicting with other python programs.

Learn Python

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more