在python3.6 环境下,在已安装cython条件下,安装pydensecrf还是报错。报错为:
eigen.cpp
c:\users\bingo\appdata\local\temp\pip-install-rvta0hhd\pydensecrf\pydensecrf\densecrf\include\eigen\src/Core/VectorBlock.h(120): error C2373: “Eigen::DenseBase<Derived>::segment”: 重定义;不同的类型修饰符
c:\users\bingo\appdata\local\temp\pip-install-rvta0hhd\pydensecrf\pydensecrf\densecrf\include\eigen\src/Core/DenseBase.h(291): note: 参见“Eigen::DenseBase<Derived>::segment”的声明
c:\users\bingo\appdata\local\temp\pip-install-rvta0hhd\pydensecrf\pydensecrf\densecrf\include\eigen\src/Core/VectorBlock.h(121): error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
c:\users\bingo\appdata\local\temp\pip-install-rvta0hhd\pydensecrf\pydensecrf\densecrf\include\eigen\src/Core/VectorBlock.h(152): error C2373: “Eigen::DenseBase<Derived>::head”: 重定义;不同的类型修饰符
c:\users\bingo\appdata\local\temp\pip-install-rvta0hhd\pydensecrf\pydensecrf\densecrf\include\eigen\src/Core/DenseBase.h(294): note: 参见“Eigen::DenseBase<Derived>::head”的声明
c:\users\bingo\appdata\local\temp\pip-install-rvta0hhd\pydensecrf\pydensecrf\densecrf\include\eigen\src/Core/VectorBlock.h(153): error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
c:\users\bingo\appdata\local\temp\pip-install-rvta0hhd\pydensecrf\pydensecrf\densecrf\include\eigen\src/Core/VectorBlock.h(184): error C2373: “Eigen::DenseBase<Derived>::tail”: 重定义;不同的类型修饰符
c:\users\bingo\appdata\local\temp\pip-install-rvta0hhd\pydensecrf\pydensecrf\densecrf\include\eigen\src/Core/DenseBase.h(297): note: 参见“Eigen::DenseBase<Derived>::tail”的声明
c:\users\bingo\appdata\local\temp\pip-install-rvta0hhd\pydensecrf\pydensecrf\densecrf\include\eigen\src/Core/VectorBlock.h(185): error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
error: command 'C:\\Program Files (x86)\\vs2017\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
自己折腾了好几天,终于解决了。
由于我重装过系统,我怀疑是不是系统问题,我试过在几个系统上试,结果在python 3.6还是会报错。
无意中试了一下在python3.5上安装,就没问题。
那就假装解决了这个问题,反正python 3.5.5又不是不能用
简单说一下,pydensecrf安装流程:
1.打开anaconda prompt
2.创建虚拟环境,conda create -n name python=3.5,(name就是你环境的名字)
3.激活环境,activate name(名字)
4.安装cython,pip install cython必须先安装cython,不然会报错
5.安装pydensecrf,pip install pydensecrf