如何将apt-get安装到我的virtualenv? [英] How I can make apt-get install to my virtualenv?
问题描述
当然有可能.
例如-我可以像这样下载python-dbus: $ sudo apt-get下载python-dbus
For example - I can download python-dbus like this: $ sudo apt-get download python-dbus
但是接下来,我应该在当前的virtualenv中使用这个.deb软件包做什么?
But what I should to do next, with this .deb package in my current virtualenv?
推荐答案
如果您确实需要这种方式,则只需将全局安装的文件直接复制到您的virtualenv中即可.例如,由于未安装必需的库,因此我无法使pycurl工作,但是apt-get install python-pycurl
可以.所以我做了以下事情:
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/
安装程序说它正在将其添加到/usr/lib/python2.7.因此,在查看了将文件复制到virtualenv中的文件之后,我在该目录中查找了带有pycurl的站点软件包或dist软件包.您还必须将任何可执行文件从bin复制到virtualenv的bin目录中.
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.
另外,运行pip install -r requirements.txt
成功在其中找到pycurl,就像我通过pip安装了它一样,就跳过了它.
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.
这篇关于如何将apt-get安装到我的virtualenv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!