“pip install pyhdf”失败并显示“hdfext_wrap.obj:错误LNK2001”

问题描述 投票:0回答:1

我想在python3中使用pyhdf,VS2022。操作系统是Windows10。 我执行了命令“

pip install pyhdf
”,但是收到了此错误消息。

Collecting pyhdf
  Using cached pyhdf-0.11.4.tar.gz (146 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in c:\users\usrname\appdata\local\programs\python\python37-32\lib\site-packages (from pyhdf) (1.21.6)
Building wheels for collected packages: pyhdf
  Building wheel for pyhdf (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyhdf (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [163 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win32-cpython-37
      creating build\lib.win32-cpython-37\pyhdf
      copying pyhdf\error.py -> build\lib.win32-cpython-37\pyhdf
      copying pyhdf\HC.py -> build\lib.win32-cpython-37\pyhdf
      copying pyhdf\HDF.py -> build\lib.win32-cpython-37\pyhdf
      copying pyhdf\hdfext.py -> build\lib.win32-cpython-37\pyhdf
      copying pyhdf\SD.py -> build\lib.win32-cpython-37\pyhdf
      copying pyhdf\six.py -> build\lib.win32-cpython-37\pyhdf
      copying pyhdf\test_SD.py -> build\lib.win32-cpython-37\pyhdf
      copying pyhdf\V.py -> build\lib.win32-cpython-37\pyhdf
      copying pyhdf\VS.py -> build\lib.win32-cpython-37\pyhdf
      copying pyhdf\__init__.py -> build\lib.win32-cpython-37\pyhdf
      running egg_info
      writing pyhdf.egg-info\PKG-INFO
      writing dependency_links to pyhdf.egg-info\dependency_links.txt
      writing requirements to pyhdf.egg-info\requires.txt
      writing top-level names to pyhdf.egg-info\top_level.txt
      reading manifest file 'pyhdf.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      no previously-included directories found matching 'doc\_build'
      adding license file 'LICENSE'
      adding license file 'AUTHORS'
      writing manifest file 'pyhdf.egg-info\SOURCES.txt'
      copying pyhdf\hdfext.i -> build\lib.win32-cpython-37\pyhdf
      copying pyhdf\hdfext_wrap.c -> build\lib.win32-cpython-37\pyhdf
      running build_ext
      building 'pyhdf._hdfext' extension
      creating build\temp.win32-cpython-37
      creating build\temp.win32-cpython-37\Release
      creating build\temp.win32-cpython-37\Release\pyhdf
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\usrname\AppData\Local\Temp\pip-build-env-phg_6zx2\overlay\Lib\site-packages\numpy\core\include -IC:\Users\usrname\AppData\Local\Programs\Python\Python37-32\include -IC:\Users\usrname\AppData\Local\Programs\Python\Python37-32\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /Tcpyhdf/hdfext_wrap.c /Fobuild\temp.win32-cpython-37\Release\pyhdf/hdfext_wrap.obj -DNOSZIP
      hdfext_wrap.c
      pyhdf/hdfext_wrap.c(4119): warning C4133: 'function': incompatible types - from 'int32 *' to 'comp_coder_t *'
      pyhdf/hdfext_wrap.c(6049): warning C4090: 'function': different 'const' qualifiers
      pyhdf/hdfext_wrap.c(6591): warning C4090: 'function': different 'const' qualifiers
      pyhdf/hdfext_wrap.c(7241): warning C4090: 'function': different 'const' qualifiers
      pyhdf/hdfext_wrap.c(7275): warning C4090: 'function': different 'const' qualifiers
      pyhdf/hdfext_wrap.c(7275): warning C4090: 'function': different 'const' qualifiers
      pyhdf/hdfext_wrap.c(8160): warning C4090: 'function': different 'const' qualifiers
      pyhdf/hdfext_wrap.c(8604): warning C4090: 'function': different 'const' qualifiers
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\bin\HostX86\x86\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\usrname\AppData\Local\Programs\Python\Python37-32\libs /LIBPATH:C:\Users\usrname\AppData\Local\Programs\Python\Python37-32 /LIBPATH:C:\Users\usrname\AppData\Local\Programs\Python\Python37-32\PCbuild\win32 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x86" mfhdf.lib hdf.lib xdr.lib libjpeg.lib zlib.lib ws2_32.lib /EXPORT:PyInit__hdfext build\temp.win32-cpython-37\Release\pyhdf/hdfext_wrap.obj /OUT:build\lib.win32-cpython-37\pyhdf\_hdfext.cp37-win32.pyd /IMPLIB:build\temp.win32-cpython-37\Release\pyhdf\_hdfext.cp37-win32.lib
         Creating library build\temp.win32-cpython-37\Release\pyhdf\_hdfext.cp37-win32.lib and object build\temp.win32-cpython-37\Release\pyhdf\_hdfext.cp37-win32.exp
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vdelete
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSsetclass
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSnattrs
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Hgetfileversion
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSfexist
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDsetfillmode
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSsizeof
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VHstoredata
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSsetattr
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDend
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VQuerytag
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDstart
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Hclose
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSwrite
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vgetversion
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDendaccess
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VFfieldesize
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vgetclass
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDgetdatastrs
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDgetinfo
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDsetcal
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSisattr
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSsetinterlace
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDgetcal
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vinsert
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSQueryref
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vsetclass
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDsetattr
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDcheckempty
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Hopen
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vaddtagref
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDnametoindex
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDsetcompress
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vgettagrefs
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDsetdimstrs
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VFfieldname
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSQuerytag
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSfind
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vdetach
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VFfieldtype
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Hgetlibversion
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vfindclass
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSattrinfo
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDgetdimstrs
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDreftoindex
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _HEvalue
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _HEstring
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSread
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSfindex
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDgetcompress
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDgetdimid
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vgettagref
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSgetclass
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSfnattrs
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vgetattr
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDiscoordvar
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vntagrefs
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDgetrange
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VHstoredatam
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VFfieldisize
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSdetach
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDreadattr
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vgetname
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Visvg
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSattach
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vgetid
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSsetname
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSfpack
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vfind
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDreaddata
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vinitialize
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDfindattr
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vnattrs
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Hishdf
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDselect
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSfindattr
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSgetfields
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDsetdimscale
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDfileinfo
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _HEprint
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vdeletetagref
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vfindattr
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDsetrange
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vinqtagref
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDcreate
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSfdefine
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vattach
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSgetname
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDsetdimname
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDattrinfo
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDgetfillvalue
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VQueryref
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vfinish
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDisrecord
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vattrinfo
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSgetid
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSgetattr
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDgetdimscale
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vnrefs
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vsetname
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSseek
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSinquire
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VFnfields
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Visvs
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSsetfields
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSgetinterlace
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDsetfillvalue
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VFfieldorder
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDsetexternalfile
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDsetdatastrs
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDidtoref
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _VSelts
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDdiminfo
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _SDwritedata
      hdfext_wrap.obj : error LNK2001: unresolved external symbol _Vsetattr
      build\lib.win32-cpython-37\pyhdf\_hdfext.cp37-win32.pyd : fatal error LNK1120: 115 unresolved externals
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX86\\x86\\link.exe' failed with exit code 1120
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyhdf
Failed to build pyhdf
ERROR: Could not build wheels for pyhdf, which is required to install pyproject.toml-based projects

可以安装其他模块,所以我认为是因为pyhdf的源代码与VS的对应有问题,但我不知道如何确认和解决。 任何帮助将不胜感激。

python pyhdf
1个回答
0
投票

这是一个链接器错误,您是否使用Python正确配置了Vistual Studio?

你的Python版本是什么,你配置过pyenv吗?

© www.soinside.com 2019 - 2024. All rights reserved.