Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can make apt-get install to my virtualenv?

It it's possible, of course.

For example - I can download python-dbus like this: $ sudo apt-get download python-dbus

But what I should to do next, with this .deb package in my current virtualenv?

like image 977
Александр Кривошеев Avatar asked Jul 11 '12 21:07

Александр Кривошеев


People also ask

Where does virtualenv get installed?

If you try to run virtualenv and find it isn't present, you can install it using pip. virtualenv.exe will likely now be found in your python installation directory under the Scripts subdirectory.

What is pip install virtualenv?

pip is a tool for installing packages from the Python Package Index. virtualenv is a tool for creating isolated Python environments containing their own copy of python , pip , and their own place to keep libraries installed from PyPI.


1 Answers

If you really need to do it this way, you can just copy the files that get installed globally directly into your virtualenv. For example I couldn't get pycurl working since the required libraries weren't installing, but apt-get install python-pycurl did. So I did the following:

sudo apt-get install python-pycurl cp /usr/lib/python2.7/dist-packages/pycurl* ~/.virtualenvs/myenv/lib/python2.7/site-packages/ 

The install said it was adding it to /usr/lib/python2.7. So I looked in that directory for a site-packages or dist-packages with pycurl, after looking at the files I copied them into my virtualenv. You'd have to also copy any executables from bin into your virtualenv's bin directory.

Also, running a pip install -r requirements.txt successfully found pycurl in there and just skipped over it as if I had installed it via pip.

like image 193
MrColes Avatar answered Sep 22 '22 03:09

MrColes