python - 我得到 ModuleNotFoundError: No module named 'Cython' 尝试制作扩展时
问题描述
我正在尝试运行此代码:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [
Extension("sum", ["a123.pyx"])]
setup(
name = 'app',
cmdclass = {'build_ext': build_ext},
ext_modules = ext_modules
)
我得到了这个错误:
Traceback (most recent call last):
File "compile.py", line 3, in <module>
from Cython.Distutils import build_ext
ImportError: No module named 'Cython'
我正在使用 Conda 并且我添加了 cython 我也在我的系统中安装 cython。但错误无法修复!
解决方案
它已通过在 conda 中卸载 cython 并重新安装来修复!
卸载:
conda uninstall cython
重新安装:
conda install -c anaconda cython
推荐阅读
- matlab - 如何在Matlab中查找句柄图形对象的所有属性、方法、事件?
- jquery - Django:尝试实现文件上传进度条
- macos - Adobe Fonts(又名 Typkekit 又名 Creative Cloud Fonts)是否在我的 Mac 上存储字体?
- r - 在R中按字母顺序对每行字符串进行排序
- javascript - 引导切换开关在页面加载时显示错误的内容
- html - 调整屏幕大小时不显示导航栏链接
- javascript - 图像在 iframe 上加载时不会全屏显示
- sql - 结合两个和语句以获得所需的结果
- sql - 为特定日期之前的任何内容创建分区
- kubernetes - 扩展服务以响应 Kubernetes 上的请求