使用pip将Python软件包从本地文件系统文件夹安装到virtualenv [英] Installing Python packages from local file system folder to virtualenv with pip

查看:61
本文介绍了使用pip将Python软件包从本地文件系统文件夹安装到virtualenv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用本地文件系统中的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆