[英]pyconfig.h - Cannot open include file: 'io.h': No such file or directory
I am new to python/Cpp and I am trying to install a python package python-crfsuite which needs to VS to compile. 我是python / Cpp的新手,我正在尝试安装一个需要VS编译的python包python-crfsuite。
I have installed Anaconda3, pyhon3.6 all in VS2017 community installer (because I think it is better because I will use compiler of VS: cl.exe
) 我在VS2017社区安装程序中安装了Anaconda3,pyhon3.6(因为我认为它更好,因为我将使用VS的编译器: cl.exe
)
I have already run vcvarsall.bat
我已经运行了vcvarsall.bat
All commands I run are in admin 我运行的所有命令都在admin中
When I trying to pip install
python-crfsuite, it gives me the error: 当我试图pip install
python-crfsuite时,它给了我错误:
C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.10.25017\\bin\\HostX86\\x86\\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include -Ipycrfsuite -Icrfsuite/win32 -Iinclude "-IC:\\Program Files\\Anaconda3\\include" "-IC:\\Program Files\\Anaconda3\\include" /EHsc /Tppycrfsuite/_pycrfsuite.cpp /Fobuild\\temp.win-amd64-3.6\\Release\\pycrfsuite/_pycrfsuite.obj _pycrfsuite.cpp c:\\program files\\anaconda3\\include\\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory error: command 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2017\\\\Community\\\\VC\\\\Tools\\\\MSVC\\\\14.10.25017\\\\bin\\\\HostX86\\\\x86\\\\cl.exe' failed with exit status 2
I have read the answer from here . 我从这里读到了答案。 So I try to replace the path in my system environment as following: C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.10.25017\\bin\\HostX86\\x86
=> C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.10.25017\\bin\\HostX86\\x86
but it doesnt do anything for me. 所以我尝试在系统环境中替换路径如下: C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.10.25017\\bin\\HostX86\\x86
=> C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.10.25017\\bin\\HostX86\\x86
但它对我没有任何作用。
Then I try to download io.h
and place in C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.10.25017\\include
but it is useless. 然后我尝试下载io.h
并放在C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.10.25017\\include
但它没用。
Finally I try to use conda install conda install -c conda-forge python-crfsuite
and it is success 最后我尝试使用conda install conda install -c conda-forge python-crfsuite
并且它是成功的
Why conda install
dose not have the problem with io.h
, any difference with pip install
? 为什么conda install
剂量没有io.h
的问题,与pip install
什么区别?
Why there are multiple cl.exe
in different path in VS (I am not so familiar with) and are there any difference in using different cl.exe
? 为什么VS中的不同路径中有多个cl.exe
(我不太熟悉),使用不同的cl.exe
有什么区别?
I ask these question because even if I installed Anaconda, if I want to use pip install, I have to face these problems and I still cannot figure it out 我问这些问题,因为即使我安装了Anaconda,如果我想使用pip install,我也要面对这些问题,我仍然无法弄明白
I got the same error but I was installing a package. 我得到了同样的错误,但我正在安装一个包。 I solved installing more tools from Visual Studio (I'm using VS 2017 Community and Python 3.6.4). 我解决了从Visual Studio安装更多工具的问题(我正在使用VS 2017社区和Python 3.6.4)。 I installed those tools (see installer screenshot here ): 我安装了这些工具(参见此处的安装程序截图):
Desktop development with C++: I included all defaulted items and the next ones: 使用C ++进行桌面开发:我包含了所有默认项目和下一个项目:
Linux development with C++ 使用C ++进行Linux开发
Then I opened the Windows PowerShell as Administrator privilegies (Right click to open) and move folder of Visual Studio installation and find that path: 然后我以管理员权限打开Windows PowerShell (右键单击打开)并移动Visual Studio安装文件夹并找到该路径:
cd [Visual Studio Path]\VC\Auxiliary\Build
Then I executed this file: 然后我执行了这个文件:
.\vcvars32.bat
After that I use pip as normal, for instance, I wanted to install Mayavi : 之后我正常使用pip,例如,我想安装Mayavi :
pip install mayavi
I hope that it helps someone too. 我希望它也有助于某人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.