Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Ubuntu server 12.04. The default python version is 2.7. I have installed python 3.3 in /opt directory. When I try to create a virtualenv to use python 3.3, I get the following error:

$virtualenv -p /opt/python3.3/bin/python3 python3_env

Running virtualenv with interpreter /opt/python3.3/bin/python3 Traceback (most recent call last): File "usr/lib/python2.7/dist-packages/", line 17, in import zlib ImportError: No module named 'zlib'

How do I resolve this?

share|improve this question

First of all, I would recommend using deadsnakes ppa How to install Python 3.3?

What you need to understand is your virtualenv package should be compatible with python3. I.e.virtualenv should be installed with python3.3. This can be done with easy_install OR pip compatible with python3.3.


Also python3.3 comes with inbuilt virtualenv which can be used as

python3.3 -m venv VIRTUAL_ENV_NAME


These binaries may be in /opt. So you may require full path.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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