我有自己的程序包,其中包含用于测试需求的requirements-test.txt,这就是我的设置工具功能
def load_requirements(req):
reqs = parse_requirements(req, session='hack')
return [str(ir.req) for ir in reqs]
requirements = load_requirements('requirements.txt')
test_requirements = load_requirements('requirements-test.txt')
setup(
name=name,
version=version_info,
author=version_info_author,
author_email=version_info_email,
packages=find_packages(exclude=['tests']),
include_package_data=True,
long_description=long_description(),
zip_safe=False,
install_requires=requirements,
normalize_version=False,
test_suite='tests',
tests_require=test_requirements
)
我运行python setup.py sdist bdist_wheel
后成功生成了tar.gz
然后我尝试使用此命令在其他应用程序上安装软件包(例如(plugin1.tar.gz)
pip install ../plugin1/dist/plugin1.tar.gz
显示错误,表明setup.py找不到requirement-test.txt
“无法打开需求文件:%s”%str(exc) pip._internal.exceptions.InstallationError:无法打开需求文件:[Errno 2]没有这样的文件或目录:'requirements-test.txt'