繁体   English   中英

setup.py 不是安装依赖项

[英]setup.py is not install dependencies

我正在尝试创建一个可以通过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 错误。

github url 似乎是正确的,根据此处的文档https: git+https://git.example.com/MyProject.git@master#egg=MyProject

运行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

这里的任何指针将不胜感激。

dependency_links被声明为过时并最终在pip 19.0 中删除 它的替代品是具有特殊语法的install_requires (自pip 19.1 起支持):

install_requires=[
    'dependency @ git+https://github.com/company/dependency.git@master',
]

https://www.python.org/dev/peps/pep-0440/#direct-references

这需要pip install ,包括pip install. 并且不适用于python setup.py install

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM