zeldor.biz

Linux, programming and more

Copyright © 2025
Log in

Python virtual environment

October 12, 2019 by Igor Drobot 1 Comment

python logo

Python virtualenv or venv are the short forms of virtual environment.
Virtualenv is useful for different projects with unique requirements for each of them, like versions of python or at least different versions of Python libraries.

So they run parallel on a same system in separated from each other environments without any conflicts between them.

Some straight forward examples on macOS:
pip3 install virtualenv

To make a virtual environment:
virtualenv venv

# make a virtual environment with special python version
virtualenv -p /usr/bin/python2.7 venv

Activate the created virtual environment:
source venv/bin/activate

Freeze environment packages:
pip freeze –local > requirements.txt

Install early freezed packages:
pip install -r requirements.txt

To get out of your virtual environment, simple type:
deactivate

Filed Under: Linux Tagged With: .py, Python, venv, virtualenv

Categories

Archives

Tags

apache2 Apple arduino ARM Automation backup bash Cisco Cluster Corosync Database Debian Debian squeeze DIY DNS Fedora FTP Fun Icinga Ipv6 KVM Linux LVM MAC OS X Monitoring MySQL Nagios Nginx openSUSE OpenVPN PHP Proxy Python python3 qemu RAID rsync Samba security ssh Ubuntu virtualization Windows Windows 7 Wordpress

Trackbacks

  1. pipenv says:
    March 1, 2020 at 22:59

    […] Virtualenv was for me until 2020 a python-default tool for creating isolated virtual environments for python projects.Virtualenv was always easy to handle and known as a mature pythonic tool under python developers. But now, its time to switch to pipenv :) […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Yeaaah Cookie! We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok