【发布时间】:2022-01-15 09:20:31
【问题描述】:
我正在尝试创建一个可以通过pip install git+https://github.com/project/neat_util.git@master#egg=neat_util 安装的命令行实用程序,并且我正在使用python setup.py install 在本地进行测试。
import os
import pathlib
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="neat_util",
version="1.0.0",
author="Cogito Ergo Sum",
author_email="cogito@ergo.sum",
description="Util for utilization",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://gitlab.com/project/repo",
classifiers=[
"Programming Language :: Python :: 3"
],
package_dir={"": "bin"},
packages=setuptools.find_packages(where="bin"),
include_package_data=True,,
dependency_links=['git+https://github.com/company/dependency.git@master#egg=dependency'],
python_requires=">=3.6",
scripts=['bin/neat_util']
)
当我在本地测试它时,它安装得很好,我可以从命令行调用它,但我得到一个 ModuleNotFoundError" No module named dependency 错误。
根据此处https://pip.pypa.io/en/stable/topics/vcs-support/ 特别是git+https://git.example.com/MyProject.git@master#egg=MyProject 的文档,github url 似乎是正确的
运行 pip install git+https://github.com/company/dependency.git@master#egg=dependency 实际上也能正常工作,所以我确信 URL 不是问题。
项目结构:
├── bin
│ ├── script1
│ ├── script2
│ ├── script3
│ ├── neat_util
│ ├── script4
│ └── script5
├── collections.csv
├── config.cfg
├── config.cfg.example
├── env.sh
├── env.sh.example
├── example.csv
├── main.py
├── README.md
├── requirements.txt
├── setup.py
└── tests
这里的任何指针将不胜感激。
【问题讨论】: