在Python3中找不到扩展模块

时间:2017-10-15 08:14:28

标签: python-3.x extension-methods

我在python3.6中做了关于scipy ndimage的教程。我现在处于C延伸点。根据教程,我创建了这个脚本:

from distutils.core import setup, Extension
import numpy

shift = Extension('example',
                  ['example.c'],
                  include_dirs=[numpy.get_include()]
)

setup(name='example',
      ext_modules=[shift]
)

但是当我运行安装脚本时,我收到以下错误。

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2862, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-79-18f2fcdde650>", line 10, in <module>
    ext_modules=[shift]
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 134, in setup
    ok = dist.parse_command_line()
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 472, in parse_command_line
    args = self._parse_command_opts(parser, args)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 521, in _parse_command_opts
    raise SystemExit("invalid command name '%s'" % command)
SystemExit: invalid command name '49295'
/usr/local/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2870: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
  warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)

以某种方式,setup()无法找到扩展程序shift。我查看了disutils.core的文档,但到目前为止可以看到它看起来我没有错... 任何人都可以解释出错的原因和原因吗?

对于C脚本和其他脚本,请参阅:Scipy ndimage extending

0 个答案:

没有答案