To update an old system I had to compile python 2.7.14 with custom openssl version. The compiled system has no virtualenv binary and also neither pip nor easy_install for extension. How can I get virtualenv for the compiled version? How about pip?

2 Answers 2


From the docs on installing packages at https://packaging.python.org/tutorials/installing-packages/#ensure-you-can-run-pip-from-the-command-line there is a section on ensuring pip by running

/path_to_compiled_python/bin/python -m ensurepip --default-pip

which will install pip. You can then use it to install the virtualenv package with

/path_to_compiled_python/bin/pip install virtualenv

The steps that helped to setup a custom version of Python with a virtual environment without doing system wide installation.

Install dependencies:

sudo apt update
sudo apt install libssl-dev openssl g++ # and possibly more.

Get Python and build it:

wget https://www.python.org/ftp/python/3.8.8/Python-3.8.8.tgz
tar xzvf Python-3.8.8.tgz
cd Python-3.8.8

Install "pip" to "~/.local/lib/python3.8/site-packages":

./python -m ensurepip --default-pip
./python -m pip install --upgrade pip

Setup the virtual environment:

# Creates a directory "./python3.8-env".
./python -m venv python3.8-env

Activate the virtual environment and install other packages.

source python3.8-env/bin/activate
pip install --upgrade pip
pip install <package>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.