使用pip将Python软件包从本地文件系统文件夹安装到virtualenv [英] Installing Python packages from local file system folder to virtualenv with pip
问题描述
是否可以使用本地文件系统中的pip安装软件包?
Is it possible to install packages using pip from the local filesystem?
我已经为我的程序包运行了python setup.py sdist
,该程序包已经创建了相应的tar.gz文件.该文件存储在我的系统上,位于/srv/pkg/mypackage/mypackage-0.1.0.tar.gz
.
I have run python setup.py sdist
for my package, which has created the appropriate tar.gz file. This file is stored on my system at /srv/pkg/mypackage/mypackage-0.1.0.tar.gz
.
现在在虚拟环境中,我想安装来自pypi或来自特定本地位置/srv/pkg
的软件包.
Now in a virtual environment I would like to install packages either coming from pypi or from the specific local location /srv/pkg
.
这可能吗?
PS
我知道我可以指定pip install /srv/pkg/mypackage/mypackage-0.1.0.tar.gz
.可以,但是我正在谈论使用/srv/pkg
位置作为另一个输入pip的位置,如果我键入pip install mypackage
的话.
PS
I know that I can specify pip install /srv/pkg/mypackage/mypackage-0.1.0.tar.gz
. That will work, but I am talking about using the /srv/pkg
location as another place for pip to search if I typed pip install mypackage
.
推荐答案
我非常确定您要查找的内容称为--find-links
选项.
I am pretty sure that what you are looking for is called --find-links
option.
尽管您可能需要为本地软件包索引生成虚拟index.html
,该虚拟index.html
列出了所有软件包的链接.该工具可以帮助:
Though you might need to generate a dummy index.html
for your local package index which lists the links to all packages. This tool helps:
https://github.com/wolever/pip2pi
这篇关于使用pip将Python软件包从本地文件系统文件夹安装到virtualenv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!