Oct. 23, 2023, 4:12 p.m. | jdxlabs

DEV Community dev.to

If you work on several Python projects, you will quickly need to have different versions of your packages, depending on the current project.


Virtual environments are designed for this, they allow to isolate the libraries between your projects. There are different libraries you can use, I will show you Venv and Pipenv.





Venv


Venv is the built-in module for creating virtual environments in Python 3.


First let’s create a simple script, that needs two packages :



import requests
import …

current environments libraries pipenv project projects python show tooling venv versions virtual work

Lead Developer (AI)

@ Cere Network | San Francisco, US

Research Engineer

@ Allora Labs | Remote

Ecosystem Manager

@ Allora Labs | Remote

Founding AI Engineer, Agents

@ Occam AI | New York

AI Engineer Intern, Agents

@ Occam AI | US

AI Research Scientist

@ Vara | Berlin, Germany and Remote