windows下pip install pydensecrf出错 ERROR: Failed building wheel for pydensecrf

弄了大半天,问题挺玄学的,可以先检查是否安装cython(pip install cython)。然而我的安装了cython还是存在问题。
报错如下:

 ERROR: Complete output from command 'd:\anaconda\envs\tensorflow\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\18882\\AppData\\Local\\Temp\\pip-req-build-oahhefc0\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\18882\AppData\Local\Temp\pip-wheel-5zhy9voy' --python-tag cp36:
  ERROR: running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\pydensecrf
  copying pydensecrf\utils.py -> build\lib.win-amd64-3.6\pydensecrf
  copying pydensecrf\__init__.py -> build\lib.win-amd64-3.6\pydensecrf
  running build_ext
  building 'pydensecrf.eigen' extension
  creating build\temp.win-amd64-3.6
  creating build\temp.win-amd64-3.6\Release
  creating build\temp.win-amd64-3.6\Release\pydensecrf
  D:\VS2017\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ipydensecrf/densecrf/include -Ipydensecrf -Id:\anaconda\envs\tensorflow\include -Id:\anaconda\envs\tensorflow\include -ID:\VS2017\VC\Tools\MSVC\14.16.27023\ATLMFC\include -ID:\VS2017\VC\Tools\MSVC\14.16.27023\include "-ID:\Windows Kits\10\include\10.0.17763.0\ucrt" "-ID:\Windows Kits\10\include\10.0.17763.0\shared" "-ID:\Windows Kits\10\include\10.0.17763.0\um" "-ID:\Windows Kits\10\include\10.0.17763.0\winrt" "-ID:\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tppydensecrf/eigen.cpp /Fobuild\temp.win-amd64-3.6\Release\pydensecrf/eigen.obj
  eigen.cpp
  c:\users\18882\appdata\local\temp\pip-req-build-oahhefc0\pydensecrf\densecrf\include\eigen\src/Core/VectorBlock.h(120): error C2373: “Eigen::DenseBase::segment”: 重定义; 不同的类型修饰符
  c:\users\18882\appdata\local\temp\pip-req-build-oahhefc0\pydensecrf\densecrf\include\eigen\src/Core/DenseBase.h(291): note: 参见“Eigen::DenseBase::segment”的声明
  c:\users\18882\appdata\local\temp\pip-req-build-oahhefc0\pydensecrf\densecrf\include\eigen\src/Core/VectorBlock.h(121): error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
  c:\users\18882\appdata\local\temp\pip-req-build-oahhefc0\pydensecrf\densecrf\include\eigen\src/Core/VectorBlock.h(152): error C2373: “Eigen::DenseBase::head”: 重定义;不同的类型修饰符
  c:\users\18882\appdata\local\temp\pip-req-build-oahhefc0\pydensecrf\densecrf\include\eigen\src/Core/DenseBase.h(294): note: 参见“Eigen::DenseBase::head”的声明
  c:\users\18882\appdata\local\temp\pip-req-build-oahhefc0\pydensecrf\densecrf\include\eigen\src/Core/VectorBlock.h(153): error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
  c:\users\18882\appdata\local\temp\pip-req-build-oahhefc0\pydensecrf\densecrf\include\eigen\src/Core/VectorBlock.h(184): error C2373: “Eigen::DenseBase::tail”: 重定义;不同的类型修饰符
  c:\users\18882\appdata\local\temp\pip-req-build-oahhefc0\pydensecrf\densecrf\include\eigen\src/Core/DenseBase.h(297): note: 参见“Eigen::DenseBase::tail”的声明
  c:\users\18882\appdata\local\temp\pip-req-build-oahhefc0\pydensecrf\densecrf\include\eigen\src/Core/VectorBlock.h(185): error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
  error: command 'D:\\VS2017\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
  ----------------------------------------
  ERROR: Failed building wheel for pydensecrf

网上出问题的大多是python3.6版本,有说3.5没问题的,但是我就是3.5,也有说setuptools没更新的
pip install –upgrade setuptools
有通过更新pydensecrf环境解决的

conda install -c conda-forge pydensecrf

还有说需要安装vsc++tool的(https://go.microsoft.com/fwlink/?LinkId=691126)
以上方法我都试了。但是还是不行,最后去这个网址下载bz2格式的对应我的安装环境的包用(conda install f:\tools\pydensecrf-1.0rc3-py35_0.tar.bz2)安装成功。

你可能感兴趣的:(环境配置问题)