gpt4 book ai didi

python 没有安装 setuptools 的 install_requires 中列出的依赖项

转载 作者:太空狗 更新时间:2023-10-29 17:51:01 24 4
gpt4 key购买 nike

我写了一个依赖openpyxl的python模块。我希望使用 setuptools 将 openpxyl 作为依赖项自动安装。我读到正确的方法是在 setup.py 脚本中包含以下内容:

setup(name='methpipe',
version=find_version("lala", "__init__.py"),
description='Utilities',
author='Jonathan T',
author_email='jt@lala.com',
url='https://git.com...',
packages=find_packages(),
install_requires=[
'openpxyl = 2.3.3',
],
scripts=["bin/submit_run_full.py"],
cmdclass=dict(install=my_install)
)

所以我用 python setup.py sdist 打包我的模块,获取 *.tar.gz 文件,解压它,然后运行 ​​python setup.py install ,并且 openpyxl 没有安装!!!

我在这里做错了什么?

最佳答案

尝试在 install_requiressetup_requires 中提供您的依赖项。

以下内容来自 setuptool 的文档,位于 https://pythonhosted.org/setuptools/setuptools.html

setup_requires

A string or list of strings specifying what other distributions need to be present in order for the setup script to run. setuptools will attempt to obtain these (even going so far as to download them using EasyInstall) before processing the rest of the setup script or commands. This argument is needed if you are using distutils extensions as part of your build process; for example, extensions that process setup() arguments and turn them into EGG-INFO metadata files.

(Note: projects listed in setup_requires will NOT be automatically installed on the system where the setup script is being run. They are simply downloaded to the ./.eggs directory if they’re not locally available already. If you want them to be installed, as well as being available when the setup script is run, you should add them to install_requires and setup_requires.)

关于python 没有安装 setuptools 的 install_requires 中列出的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35516059/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com