通过pip将软件包安装到单独的目录

时间:2019-01-14 13:20:14

标签: python python-3.x pip

我正在尝试将依赖包安装到现有项目中的单独目录中,如下所示:

python -m pip install -t C:\Users\Mahdi\eclipse-workspace\
google-cloud-functions\com\mahdi\python\functions\gcs\dependency com.mahdi.python.file_igestion

但是我得到以下错误。我有什么想念吗?

Could not find a version that satisfies the requirement com.mahdi.pyhton.file_igestion (from versions: )
No matching distribution found for com.mahdi.pyhton.file_igestion

编辑:根据建议,我可以通过setup.py sdidst来安装软件包,并且可以看到已安装的软件包

C:\Users\Mahdi\eclipse-workspace\google-cloud-functions>python -m pip list
Package                  Version    Location
------------------------ ---------- -------------------------------------------------------
file-ingestion           0.2        c:\users\mahdi\eclipse-workspace\google-cloud-functions

但是当我运行打击命令时,我仍然会出错

C:\Users\Mahdi\eclipse-workspace\google-cloud-functions\com\mahdi\python\functions\gcs>python -m pip install -t C:\Users\Mahdi\ecli
pse-workspace\google-cloud-functions\com\mahdi\python\functions\gcs\dependency file-ingestion
Collecting file-ingestion
  Could not find a version that satisfies the requirement file-ingestion (from versions: )
No matching distribution found for file-ingestion
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

1 个答案:

答案 0 :(得分:1)

要安装在本地构建的软件包,您需要使用类似于

的工具

pip install mypackage --no-index --find-links file:///srv/pkg/mypackage

您需要先使用python setup.py sdist将其打包。