【发布时间】:2015-03-05 05:07:57
【问题描述】:
我最近收到了一个拉取请求,其中添加了
class build_ext(_build_ext):
'to install numpy'
def finalize_options(self):
_build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
__builtins__.__NUMPY_SETUP__ = False
import numpy
self.include_dirs.append(numpy.get_include())
到我的setup.py 导致:
from setuptools.command.build_ext import build_ext as _build_ext
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
class build_ext(_build_ext):
'to install numpy'
def finalize_options(self):
_build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
__builtins__.__NUMPY_SETUP__ = False
import numpy
self.include_dirs.append(numpy.get_include())
config = {
'cmdclass':{'build_ext':build_ext}, #numpy hack
'setup_requires':['numpy'], #numpy hack
'name': 'nntoolkit',
'version': '0.1.25',
'author': 'Martin Thoma',
'author_email': 'info@martin-thoma.de',
'packages': ['nntoolkit'],
'scripts': ['bin/nntoolkit'],
'url': 'https://github.com/MartinThoma/nntoolkit',
'license': 'MIT',
'description': 'Neural Network Toolkit',
'long_description': """...""",
'install_requires': [
"argparse",
"theano",
"nose",
"natsort",
"PyYAML",
"matplotlib",
"h5py",
"numpy",
"Cython"
],
'keywords': ['Neural Networks', 'Feed-Forward', 'NN', 'MLP'],
'download_url': 'https://github.com/MartinThoma/nntoolkit',
'classifiers': ['Development Status :: 3 - Alpha'],
'zip_safe': False,
'test_suite': 'nose.collector'
}
setup(**config)
它有什么作用?
documentation 只声明:
cmdclass:命令名称到
Command子类的映射(字典)
【问题讨论】:
-
明显有错别字。它应该是:'cmdclass':{'build_ext':build_ext}, #numpy hack
标签: python setuptools