How to set up a Python virtual environment in Fedora

Intro

Python virtual environment are a great way to isolate different Python configurations, allowing to build projects with its own dependencies without interfering with each other.
In this post, I’ll show how to set up a Python virtual environment in Fedora.

Installation

Assuming you already have a running machine with Fedora, or a similar distro, you can install the package (and its dependencies) just by running the following command:

sudo dnf install python3-virtualenv

Now you’re ready to use it by calling it using the next command:

virtualenv3 test_app

which will create a folder called test_app and place all necessary dependencies in it.

You can specify all sort of options when creating your environment, e.g. the python version you want to use:

virtualenv-3 test_app --python=/usr/bin/python36

where I specified the version of Python 3.6, and so on.
For all the documentation head to the official webpage.

Any comments? Let me know!

comments powered by Disqus