问题描述
我有一个要安装到我的virtualenv中的python程序-这是一个我需要解压缩然后运行setup.py程序的zip程序包-但是我的问题是更多关于如何将这些未压缩的文件放入我的virtualenv中的问题该软件包是否已安装到virtualenv的site-packages文件夹中?
I have a python program I want to install into my virtualenv - it's a zip package that I need to unzip and then run a setup.py program - but my question is more regarding how to get these unzipped files into my virtualenv so that the package gets installed into the virtualenv's site-packages folder?
我也可以使用pip install <package name>
从virtualenv内部安装,但是由于某些原因,PIP下载的软件包已过期.
I can also install from inside my virtualenv using pip install <package name>
, but for some reason, the package that PIP downloads is out of date.
所以-有人可以告诉我一些手动安装软件包的简单步骤吗?
So - can someone tell me a few easy steps for installing a package manually?
到目前为止,我已经掌握了加载Virtualenv的基本命令:
So far I have the basic commands to load up the Virtualenv:
-bash-3.2$ source ~/.bashrc
-bash-3.2$ workon test
(test)-bash-3.2$ //Now I'm working on my virtualenv, but where do I go after this??
那么-将python包/程序解压缩到什么位置是否重要-还是应该在解压缩之前先登录到virtualenv?加载virtualenv并在内部使用"workon test"命令使用它之后,无论我找到它的目录如何,我安装的所有python软件包都会安装到适当的virtualenv的site-packages文件夹中吗?
So - does it matter where I unzip the python package/program to - or should I be logged in to the virtualenv first before unzipping? After I load up the virtualenv and I'm inside using it with the 'workon test' command, will any python package I install, regardless of the directory I find it, install itself into the proper virtualenv's site-packages folder?
选项1是将python程序解压缩到/home/username/tmp-然后登录到我的virtualenv,导航到该文件夹并运行setup.py程序-假设virtualenv会将所有相关文件传输到其自己的站点-packages文件夹.
Option 1 is to unzip the python program into /home/username/tmp - then log into my virtualenv, navigate to that folder and run the setup.py program - assuming that the virtualenv will transfer all relevant files to it's own site-packages folder.
或方案2是将文件直接解压缩到站点包中,然后从那里运行(登录到virtualenv之后),等等
OR scenario 2 is to unzip the files directly into site-packages, and run it from there (after logging in to the virtualenv), etc
感谢您帮助Python clutz!
Thank you for helping a Python clutz with this!
推荐答案
我通常将程序提取到一个临时文件夹中,然后从该文件夹中使用指向virtualenv python实例的直接路径运行setup.py.例如,如果您的virtualenv位于/home/username/virtualpy中,则使用此文件(从您的临时文件夹中)
I typically would extract the program to a temporary folder, then from that folder, run the setup.py using the direct path to the virtualenv python instance. eg if your virtualenv is in /home/username/virtualpy, use this (from your temporary folder)
/home/username/virtualpy/bin/python setup.py install
这应将其安装到您的virtualenv网站软件包文件夹中.
This should install it to your virtualenv site package folder.
这篇关于Python-使用virtualenv手动安装软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!