Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get pip to install packages into the virtual environment?

On Windows 8, i have the following structure for a Python 3 project:

../Project/
../Project/app/app.py
../Project/app/setup.py

From the app folder, i invoke the following commands to create and enter into a virtual environment:

pyvenv.py venv
cd venv\Scripts
activate.bat
cd ../..

Now i would like to install the Nose unit testing framework into my virtual environment:

pip install nose

... and Nose gets installed into the global folder (In my case, C:\Python33).

When i invoke python setup.py install, my custom module gets installed to the virtual environment. Why doesn't PIP do the same?

like image 702
Dante Avatar asked Nov 08 '13 07:11

Dante


1 Answers

It works well for me after following docs:

Common installation tools such as Distribute and pip work as expected with venvs - i.e. when a venv is active, they install Python packages into the venv without needing to be told to do so explicitly. Of course, you need to install them into the venv first: this could be done by running distribute_setup.py with the venv activated, followed by running easy_install pip. Alternatively, you could download the source tarballs and run python setup.py install after unpacking, with the venv activated.

like image 100
alko Avatar answered Oct 05 '22 23:10

alko