python没有安装setuptools的install_requires中列出的依赖项 [英] python is not installing dependencies listed in install_requires of setuptools
问题描述
我写了一个依赖于openpyxl的python模块.我希望使用setuptools将openpxyl自动安装为依赖项. 我读到,执行此操作的正确方法是在setup.py脚本中包含以下内容:
I have written a python module that depends on openpyxl. I want openpxyl to be installed as a dependency automatically using setuptools. I read that the proper way to do this is to include the following in the setup.py script:
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没有安装!
So I packaged up my module with python setup.py sdist
, took the *.tar.gz file, unzipped it, and then ran python setup.py install
, and openpyxl is NOT installing!!!
我在做什么错了?
推荐答案
我注意到当您使用带有'cmdclass'键的覆盖'install'时.下面的模式也使我摆脱了依赖关系.
I notice when you use override 'install' with a 'cmdclass' key. The pattern below also left me with uninstalled dependencies.
Custom_Install(install):
def run(self):
# some custom commands
install.run(self)
将依赖项添加到setup_requires中对我来说不起作用,因此最终我只在custom install命令中完成了自己的pip安装.
Adding the dependencies into setup_requires didn't work for me so in the end I just did my own pip install in the custom install command..
def pip_install(package_name):
subprocess.call(
[sys.executable, '-m', 'pip', 'install', package_name]
)
这篇关于python没有安装setuptools的install_requires中列出的依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!