当前位置: 首页 > news >正文

Cython编译文件出错

报错信息:

(rpc) stu@amax:~/segment/dss_crf$ python setup.py install
Compiling pydensecrf/eigen.pyx because it changed.
Compiling pydensecrf/densecrf.pyx because it changed.
[1/2] Cythonizing pydensecrf/densecrf.pyx
/home/stu/anaconda3/envs/rpc/lib/python3.6/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /home/stu03/kdy/rpc/segment/dss_crf/pydensecrf/densecrf.pxdtree = Parsing.p_module(s, pxd, full_module_name)Error compiling Cython file:
------------------------------------------------------------
...
from eigen cimport *
^
------------------------------------------------------------pydensecrf/densecrf.pxd:1:0: 'eigen.pxd' not foundError compiling Cython file:
------------------------------------------------------------
...cdef cppclass PottsCompatibility(LabelCompatibility):PottsCompatibility(float) except +cdef cppclass DiagonalCompatibility(LabelCompatibility):DiagonalCompatibility(const c_VectorXf&) except +^
------------------------------------------------------------pydensecrf/densecrf.pxd:12:36: 'c_VectorXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...cdef cppclass DiagonalCompatibility(LabelCompatibility):DiagonalCompatibility(const c_VectorXf&) except +cdef cppclass MatrixCompatibility(LabelCompatibility):MatrixCompatibility(const c_MatrixXf&) except +^
------------------------------------------------------------pydensecrf/densecrf.pxd:15:34: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...
cdef extern from "densecrf/include/unary.h":cdef cppclass UnaryEnergy:passcdef cppclass ConstUnaryEnergy(UnaryEnergy):ConstUnaryEnergy(const c_MatrixXf& unary) except +^
------------------------------------------------------------pydensecrf/densecrf.pxd:23:31: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...cdef cppclass ConstUnaryEnergy(UnaryEnergy):ConstUnaryEnergy(const c_MatrixXf& unary) except +cdef cppclass LogisticUnaryEnergy(UnaryEnergy):LogisticUnaryEnergy(const c_MatrixXf& L, const c_MatrixXf& feature) except +^
------------------------------------------------------------pydensecrf/densecrf.pxd:26:34: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...cdef cppclass ConstUnaryEnergy(UnaryEnergy):ConstUnaryEnergy(const c_MatrixXf& unary) except +cdef cppclass LogisticUnaryEnergy(UnaryEnergy):LogisticUnaryEnergy(const c_MatrixXf& L, const c_MatrixXf& feature) except +^
------------------------------------------------------------pydensecrf/densecrf.pxd:26:55: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...c_DenseCRF(int N, int M) except +# Setup methods.# TODO#void addPairwiseEnergy(PairwisePotential *potential)void addPairwiseEnergy(const c_MatrixXf &features, LabelCompatibility*, KernelType, NormalizationType)^
------------------------------------------------------------pydensecrf/densecrf.pxd:54:37: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...# Setup methods.# TODO#void addPairwiseEnergy(PairwisePotential *potential)void addPairwiseEnergy(const c_MatrixXf &features, LabelCompatibility*, KernelType, NormalizationType)void setUnaryEnergy(UnaryEnergy *unary)void setUnaryEnergy(const c_MatrixXf &unary)^
------------------------------------------------------------pydensecrf/densecrf.pxd:56:34: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...# TODO#void addPairwiseEnergy(PairwisePotential *potential)void addPairwiseEnergy(const c_MatrixXf &features, LabelCompatibility*, KernelType, NormalizationType)void setUnaryEnergy(UnaryEnergy *unary)void setUnaryEnergy(const c_MatrixXf &unary)void setUnaryEnergy(const c_MatrixXf &L, const c_MatrixXf &feature)^
------------------------------------------------------------pydensecrf/densecrf.pxd:57:34: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...# TODO#void addPairwiseEnergy(PairwisePotential *potential)void addPairwiseEnergy(const c_MatrixXf &features, LabelCompatibility*, KernelType, NormalizationType)void setUnaryEnergy(UnaryEnergy *unary)void setUnaryEnergy(const c_MatrixXf &unary)void setUnaryEnergy(const c_MatrixXf &L, const c_MatrixXf &feature)^
------------------------------------------------------------pydensecrf/densecrf.pxd:57:55: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...void setUnaryEnergy(UnaryEnergy *unary)void setUnaryEnergy(const c_MatrixXf &unary)void setUnaryEnergy(const c_MatrixXf &L, const c_MatrixXf &feature)# Inference methods.c_MatrixXf inference(int n_iterations)^
------------------------------------------------------------pydensecrf/densecrf.pxd:60:8: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...c_MatrixXf inference(int n_iterations)# TODO: Not enabled because it would require wrapping VectorXs (note the `s`)#c_VectorXs map(int n_iterations)# Step-by-step inference methods.c_MatrixXf startInference() const^
------------------------------------------------------------pydensecrf/densecrf.pxd:65:8: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...# TODO: Not enabled because it would require wrapping VectorXs (note the `s`)#c_VectorXs map(int n_iterations)# Step-by-step inference methods.c_MatrixXf startInference() constvoid stepInference(c_MatrixXf &Q, c_MatrixXf &tmp1, c_MatrixXf &tmp2) const^
------------------------------------------------------------pydensecrf/densecrf.pxd:66:27: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...# TODO: Not enabled because it would require wrapping VectorXs (note the `s`)#c_VectorXs map(int n_iterations)# Step-by-step inference methods.c_MatrixXf startInference() constvoid stepInference(c_MatrixXf &Q, c_MatrixXf &tmp1, c_MatrixXf &tmp2) const^
------------------------------------------------------------pydensecrf/densecrf.pxd:66:42: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...# TODO: Not enabled because it would require wrapping VectorXs (note the `s`)#c_VectorXs map(int n_iterations)# Step-by-step inference methods.c_MatrixXf startInference() constvoid stepInference(c_MatrixXf &Q, c_MatrixXf &tmp1, c_MatrixXf &tmp2) const^
------------------------------------------------------------pydensecrf/densecrf.pxd:66:60: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...# Step-by-step inference methods.c_MatrixXf startInference() constvoid stepInference(c_MatrixXf &Q, c_MatrixXf &tmp1, c_MatrixXf &tmp2) const#double gradient( int n_iterations, const ObjectiveFunction & objective, c_VectorXf * unary_grad, c_VectorXf * lbl_cmp_grad, c_VectorXf * kernel_grad=NULL ) const;double klDivergence(const c_MatrixXf &Q) const^
------------------------------------------------------------pydensecrf/densecrf.pxd:69:34: 'c_MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...return eigen.MatrixXf().wrap(self._this.inference(niter))def startInference(self):return eigen.MatrixXf().wrap(self._this.startInference()), eigen.MatrixXf(), eigen.MatrixXf()def stepInference(self, MatrixXf Q, MatrixXf tmp1, MatrixXf tmp2):^
------------------------------------------------------------pydensecrf/densecrf.pyx:85:28: 'MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...return eigen.MatrixXf().wrap(self._this.inference(niter))def startInference(self):return eigen.MatrixXf().wrap(self._this.startInference()), eigen.MatrixXf(), eigen.MatrixXf()def stepInference(self, MatrixXf Q, MatrixXf tmp1, MatrixXf tmp2):^
------------------------------------------------------------pydensecrf/densecrf.pyx:85:40: 'MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...return eigen.MatrixXf().wrap(self._this.inference(niter))def startInference(self):return eigen.MatrixXf().wrap(self._this.startInference()), eigen.MatrixXf(), eigen.MatrixXf()def stepInference(self, MatrixXf Q, MatrixXf tmp1, MatrixXf tmp2):^
------------------------------------------------------------pydensecrf/densecrf.pyx:85:55: 'MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...return eigen.MatrixXf().wrap(self._this.startInference()), eigen.MatrixXf(), eigen.MatrixXf()def stepInference(self, MatrixXf Q, MatrixXf tmp1, MatrixXf tmp2):self._this.stepInference(Q.m, tmp1.m, tmp2.m)def klDivergence(self, MatrixXf Q):^
------------------------------------------------------------pydensecrf/densecrf.pyx:88:27: 'MatrixXf' is not a type identifierError compiling Cython file:
------------------------------------------------------------
...def addPairwiseEnergy(self, float[:,::1] features not None, compat, KernelType kernel=DIAG_KERNEL, NormalizationType normalization=NORMALIZE_SYMMETRIC):self._this.addPairwiseEnergy(eigen.c_matrixXf(features), _labelcomp(compat), kernel, normalization)def setUnary(self, Unary u):self._this.setUnaryEnergy(u.move())^
------------------------------------------------------------pydensecrf/densecrf.pyx:71:33: ambiguous overloaded method
Traceback (most recent call last):File "setup.py", line 16, in <module>ext_modules=cythonize(['pydensecrf/eigen.pyx', 'pydensecrf/densecrf.pyx']),File "/home/stu/anaconda3/envs/rpc/lib/python3.6/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonizecythonize_one(*args)File "/home/stu/anaconda3/envs/rpc/lib/python3.6/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_oneraise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: pydensecrf/densecrf.pyx
(rpc) stu@amax:~/segment/dss_crf$

解决方法

(1)尝试从该目录中删除__init__.py。由于某些原因,它在尝试编译时混淆了cython。

(2)考虑使用pyximport扩展名: import pyximport; pyximport.install(),然后import your_module(好像是一个normal.py),如果您只想从普通python文件导入.pyx文件。

注意:在第一种情况下,__init__.py不必删除。

http://www.lryc.cn/news/195952.html

相关文章:

  • WPF 用户控件依赖注入赋值
  • leetcode-48.旋转图像
  • antd的RangePicker设置默认值,默认近七天(andt+react)
  • 大数据可视化模块竞赛Vue项目文件结构与注意事项
  • 户外运动盛行,运动品牌如何利用软文推广脱颖而出?
  • 2024年孝感市建筑类中级职称申报资料私企VS国企
  • OpenResty安装
  • 通过stream对list集合中对象的多个字段进行去重
  • 招投标系统软件源码,招投标全流程在线化管理
  • css设置文本溢出隐藏...
  • 【小尘送书-第八期】《小团队管理:如何轻松带出1+1>2的团队》
  • 【网络协议】聊聊ifconfig
  • python项目之AI动物识别工具的设计与实现(django)
  • 全流量安全分析发现内部系统外联异常
  • Edge---微软浏览器-兼容性问题-解决办法(详细)
  • for循环遍历的`form表单组件`rules规则校验失效问题——下拉框选择之后还是报红---亲测有效
  • 【Python数据分析工具】
  • Python数据挖掘入门进阶与实用案例:自动售货机销售数据分析与应用
  • 2.3_9吸烟者问题
  • 位运算基础知识及性质(精简总结)
  • 阵列信号处理_对比常规波束形成法(CBF)和Capon算法
  • 通过循环生成多个echarts图表并实现自适应
  • MySQL——六、库表操作(下篇)
  • 自动化办公篇之python批量改名
  • Android MediaCodec将h264实时视频流数据解码为yuv,并转换yuv的颜色格式为nv21
  • Postgresql SQL 字段拼接
  • MySQL 迁移完不能快速导数据了?
  • Lazysysadmin靶机
  • LeetCode09——回文数
  • 云安全—分布式基础