Installing Python packages from local file system folder with pip

Is it possible to install packages using pip from the local filesystem?

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 .

Now in a virtual environment I would like to install packages either coming from pypi or from the specific local location /srv/pkg .

Is this possible?

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 .


I am pretty sure that what you are looking for is called --find-links option.

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


What about::

pip install --help
...
  -e, --editable <path/url>   Install a project in editable mode (i.e. setuptools
                              "develop mode") from a local project path or a VCS url.

eg, pip install -e /srv/pkg

where /srv/pkg is the top-level directory where 'setup.py' can be found.


This is very simple. The command you need is:

pip install -e <DIRECTORY>

Note that the directory must have a setup.py file in it

链接地址: http://www.djcxy.com/p/26390.html

上一篇: 安装不能在我的Mac上工作?

下一篇: 用pip从本地文件系统文件夹安装Python包