Heroku python在主要需求之前安装前置需求
我正在尝试将python flask应用程序推送到heroku。我有一个requirements.txt文件,但我不知道如何安装requirements.txt文件中的一个依赖项所需的先决条件。我在requirements.txt文件中有一个github repo作为依赖项,但这需要Heroku python在主要需求之前安装前置需求,python,git,heroku,cython,requirements.txt,Python,Git,Heroku,Cython,Requirements.txt,我正在尝试将python flask应用程序推送到heroku。我有一个requirements.txt文件,但我不知道如何安装requirements.txt文件中的一个依赖项所需的先决条件。我在requirements.txt文件中有一个github repo作为依赖项,但这需要Cython和numpy来安装。在我的requirements.txt文件中添加Cython和numpy时,即使Cython和numpy在requirements.txt文件的github repo之前,它也会显示错
Cython
和numpy
来安装。在我的requirements.txt文件中添加Cython
和numpy
时,即使Cython
和numpy
在requirements.txt文件的github repo之前,它也会显示错误
错误日志
File "/Users/sayam/Desktop/ti-heroku/venv3/src/detectron/setup.py", line 12, in <module>
from Cython.Build import cythonize
ImportError: No module named Cython.Build
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
请注意,前面在requirements.txt文件中提到了Cython和numpy,但它给出了一个错误
我在这里提到的github repo在其setup.py文件中包含以下内容
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
##############################################################################
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from Cython.Build import cythonize
from setuptools import Extension
from setuptools import setup
import numpy as np
_NP_INCLUDE_DIRS = np.get_include()
# Extension modules
ext_modules = [
Extension(
name='detectron.utils.cython_bbox',
sources=[
'detectron/utils/cython_bbox.pyx'
],
extra_compile_args=[
'-Wno-cpp'
],
include_dirs=[
_NP_INCLUDE_DIRS
]
),
Extension(
name='detectron.utils.cython_nms',
sources=[
'detectron/utils/cython_nms.pyx'
],
extra_compile_args=[
'-Wno-cpp'
],
include_dirs=[
_NP_INCLUDE_DIRS
]
)
]
setup(
name='Detectron',
packages=['detectron'],
ext_modules=cythonize(ext_modules)
)
另外,由于它是Heroku,我不能在运行requirements.txt文件之前手动执行pip install Cython
和pip install numpy
请建议解决此问题的方法。您链接到的第一个问题的可能重复内容非常糟糕—屏幕上的一个小说明和一些糟糕的照片。我想最好是在这个问题上得到一个像样的答案(如果可能的话,再重复一次),然后关闭另一个,希望以后再也看不到了。或者把问题编辑成有价值的东西。@phd,我已经看到了,那篇文章没有准确地描述问题,提到的解决方案也不完整。我已经提供了所有可用的信息,我想要一个比你所指的帖子更具描述性的回复,以便更好地理解这个问题。
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
##############################################################################
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from Cython.Build import cythonize
from setuptools import Extension
from setuptools import setup
import numpy as np
_NP_INCLUDE_DIRS = np.get_include()
# Extension modules
ext_modules = [
Extension(
name='detectron.utils.cython_bbox',
sources=[
'detectron/utils/cython_bbox.pyx'
],
extra_compile_args=[
'-Wno-cpp'
],
include_dirs=[
_NP_INCLUDE_DIRS
]
),
Extension(
name='detectron.utils.cython_nms',
sources=[
'detectron/utils/cython_nms.pyx'
],
extra_compile_args=[
'-Wno-cpp'
],
include_dirs=[
_NP_INCLUDE_DIRS
]
)
]
setup(
name='Detectron',
packages=['detectron'],
ext_modules=cythonize(ext_modules)
)