使用 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
.
这可能吗?
附注我知道我可以指定 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.
你可以做到
pip install mypackage --no-index --find-links file:///srv/pkg/mypackage
这篇关于使用 pip 将 Python 包从本地文件系统文件夹安装到 virtualenv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!