经过整整一周尝试所有可以想象和难以想象的事情后,我感到非常沮丧,似乎他们的SDK(https://www.microsoft.com/en-us/download/details.aspx?id=57467)缺少了一些东西:
C:\Anaconda3\PCbuild\amd64 /LIBPATH:build\temp.win-amd64-3.7 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763
.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x64" msmpi.lib /EXPORT:PyInit_MPI build\temp.win-amd64-3.
7\Release\src/MPI.obj /OUT:build\lib.win-amd64-3.7\mpi4py\MPI.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\src\MPI.cp37-win_amd64.lib
MPI.obj : warning LNK4197: export 'PyInit_MPI' specified multiple times; using first specification
Creating library build\temp.win-amd64-3.7\Release\src\MPI.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\src\MPI.cp37-win_amd64.exp
MPI.obj : error LNK2001: unresolved external symbol MPI_Ireduce_scatter
MPI.obj : error LNK2001: unresolved external symbol MPI_Iallgatherv
MPI.obj : error LNK2001: unresolved external symbol MPI_Iexscan
MPI.obj : error LNK2001: unresolved external symbol MPI_Iscan
MPI.obj : error LNK2001: unresolved external symbol MPI_Ialltoallw
MPI.obj : error LNK2001: unresolved external symbol MPI_Ireduce_scatter_block
MPI.obj : error LNK2001: unresolved external symbol MPI_Ialltoall
MPI.obj : error LNK2001: unresolved external symbol MPI_Ialltoallv
MPI.obj : error LNK2001: unresolved external symbol MPI_Reduce_scatter_block
build\lib.win-amd64-3.7\mpi4py\MPI.cp37-win_amd64.pyd : fatal error LNK1120: 9 unresolved externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1120
如果它真的不可能使它工作,那么告诉我应该使用哪种MPI分配而不是Microfost MPI,因为https://www.mpich.org/downloads/没有为Windows提供任何替代方案。
P.S。:mpi4py 2.0.0与python 3.7不兼容(至少Anaconda告诉我),所以我宁愿选择MPICH的另一个发行版(如果有的话)而不是降级我的python。
我已经使用3.7.0了...
我从https://www.microsoft.com/en-us/download/details.aspx?id=57467下载了MSMPI我运行了两个文件,然后将它添加到PATH(C:\ Program Files(x86)\ Microsoft SDKs \ MPI)
然后我才使用python -m pip install mpi4py
要运行MPI程序,我然后我们mpiexec -n [number of cores] python .\filename
我在Windows 10上运行AMD A-10 9600P。
我确实安装了Visual Studio,所以它可能会挂钩到你没有的一些库中......
我终于开始工作了: