Installing Ansible Python Virtual Environment To Run Multiple Version

Python virtual environments are used to create isolated python environments to avoid dependency and version conflicts, and also indirectly take care of permission issues.. Python PIP python virtual environment to run multiple versions of Ansible. Ansible can be installed where you did not have access to install packages just run with PIP to setup virtual environment. Installing Ansible Python Virtual Environment To Run Multiple Versions in Same machine.

Installing Ansible Python Virtual Environment

This python environment will create isolated virtual environment where ever you create directory and install in it.

Fedora 22 or above install dependent packages

$ sudo dnf install python-virtualenv

In Ubuntu

$ sudo apt-get install virtualenv

Red Hat/Centos

$ sudo yum install python-vritualenv

Also install development packages gcc compiler and openssl package

$ sudo dnf install gcc openssl-devel  ##Fedora
$ sudo apt-get install gcc openssl-devel  ##Ubuntu
$ yum install gcc gcc+ openssl-devel ##Red Hat/Centos

Create Virtual python environment

$ virtualenv  ~/ansible

Activate virtual environment path

$ source ~/ansible/bin/activate

Verify the pip installation path changed to configured

$ which pip

Search for ansible is available in pip

$ pip search ansible |grep ^ansible

Now install ansible using pip command

$ pip install ansible

you can verify using which command where actually ansible installed

$ which ansible


Installing Ansible Python Virtual Environment is an isolated environment and secure. You can install multiple versions of ansible with out disturbing existing one.

 Related Articles

Setup Linux Lab Environment at home

Install Puppet in RHEL 7

For more Documents

Thanks for your wonderful Support and Encouragement