Make virtualenv inherit specific packages from your global site-packages

Create the environment with virtualenv –system-site-packages . Then, activate the virtualenv and when you want things installed in the virtualenv rather than the system python, use pip install –ignore-installed or pip install -I . That way pip will install what you’ve requested locally even though a system-wide version exists. Your python interpreter will look first … Read more

What’s the proper way to install pip, virtualenv, and distribute for Python?

You can do this without installing anything into python itself. You don’t need sudo or any privileges. You don’t need to edit any files. Install virtualenv into a bootstrap virtual environment. Use the that virtual environment to create more. Since virtualenv ships with pip and distribute, you get everything from one install. Download virtualenv: http://pypi.python.org/pypi/virtualenv … Read more

Activate a virtualenv with a Python script

If you want to run a Python subprocess under the virtualenv, you can do that by running the script using the Python interpreter that lives inside virtualenv’s /bin/ directory: import subprocess # Path to a Python interpreter that runs any Python script # under the virtualenv /path/to/virtualenv/ python_bin = “/path/to/virtualenv/bin/python” # Path to the script … Read more

No module named pkg_resources

July 2018 Update Most people should now use pip install setuptools (possibly with sudo). Some may need to (re)install the python-setuptools package via their package manager (apt-get install, yum install, etc.). This issue can be highly dependent on your OS and dev environment. See the legacy/other answers below if the above isn’t working for you. … Read more

What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc?

This is my personal recommendation for beginners: start by learning virtualenv and pip, tools which work with both Python 2 and 3 and in a variety of situations, and pick up other tools once you start needing them. Now on to the answer to the question: what is the difference between these simalarly named things: … Read more