Pip 错误 - 无法打开包含文件:“basetsd.h”:没有此文件或目录

Pip 错误 - 无法打开包含文件:“basetsd.h”:没有此文件或目录

[已解决] 在评论中回答!

我正在尝试在 Python 中安装这些要求(jaydebeapi==1.2.3)并遇到以下问题。

错误的主要信息是:“无法打开包含文件:“basetsd.h”:没有此文件或目录

OBS:我正在使用 Pycharm、Python 3.8 和 Windows 10。

Running setup.py install for JPype1 ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\program files (x86)\python 3.8.5\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\nakanov\\AppData\\Local\\Temp\\pip-install-1_cw9km2\\
jpype1_abb3802e6dfd4c54b583d9883ffd5d06\\setup.py'"'"'; __file__='"'"'C:\\Users\\nakanov\\AppData\\Local\\Temp\\pip-install-1_cw9km2\\jpype1_abb3802e6dfd4c54b583d9883ffd5d06\\setup.py'"'"';f = ge
tattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"')
;f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\nakanov\AppData\Local\Temp\pip-record-tt0zqrwa\install-record.txt' --single-version-externally-managed --user
--prefix= --compile --install-headers 'C:\Users\nakanov\AppData\Roaming\Python\Python38\Include\JPype1'
         cwd: C:\Users\nakanov\AppData\Local\Temp\pip-install-1_cw9km2\jpype1_abb3802e6dfd4c54b583d9883ffd5d06\
    Complete output (59 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.8
    creating build\lib.win32-3.8\jpype
    copying jpype\beans.py -> build\lib.win32-3.8\jpype
    copying jpype\config.py -> build\lib.win32-3.8\jpype
    copying jpype\dbapi2.py -> build\lib.win32-3.8\jpype
    copying jpype\imports.py -> build\lib.win32-3.8\jpype
    copying jpype\nio.py -> build\lib.win32-3.8\jpype
    copying jpype\pickle.py -> build\lib.win32-3.8\jpype
    copying jpype\protocol.py -> build\lib.win32-3.8\jpype
    copying jpype\types.py -> build\lib.win32-3.8\jpype
    copying jpype\_classpath.py -> build\lib.win32-3.8\jpype
    copying jpype\_core.py -> build\lib.win32-3.8\jpype
    copying jpype\_gui.py -> build\lib.win32-3.8\jpype
    copying jpype\_jarray.py -> build\lib.win32-3.8\jpype
    copying jpype\_jclass.py -> build\lib.win32-3.8\jpype
    copying jpype\_jcollection.py -> build\lib.win32-3.8\jpype
    copying jpype\_jcustomizer.py -> build\lib.win32-3.8\jpype
    copying jpype\_jexception.py -> build\lib.win32-3.8\jpype
    copying jpype\_jinit.py -> build\lib.win32-3.8\jpype
    copying jpype\_jio.py -> build\lib.win32-3.8\jpype
    copying jpype\_jmethod.py -> build\lib.win32-3.8\jpype
    copying jpype\_jobject.py -> build\lib.win32-3.8\jpype
    copying jpype\_jpackage.py -> build\lib.win32-3.8\jpype
    copying jpype\_jproxy.py -> build\lib.win32-3.8\jpype
    copying jpype\_jstring.py -> build\lib.win32-3.8\jpype
    copying jpype\_jthread.py -> build\lib.win32-3.8\jpype
    copying jpype\_jvmfinder.py -> build\lib.win32-3.8\jpype
    copying jpype\_pykeywords.py -> build\lib.win32-3.8\jpype
    copying jpype\__init__.py -> build\lib.win32-3.8\jpype
    package init file 'jpype\_pyinstaller\__init__.py' not found (or not a regular file)
    creating build\lib.win32-3.8\jpype\_pyinstaller
    copying jpype\_pyinstaller\entry_points.py -> build\lib.win32-3.8\jpype\_pyinstaller
    copying jpype\_pyinstaller\example.py -> build\lib.win32-3.8\jpype\_pyinstaller
    copying jpype\_pyinstaller\hook-jpype.py -> build\lib.win32-3.8\jpype\_pyinstaller
    copying jpype\_pyinstaller\test_jpype_pyinstaller.py -> build\lib.win32-3.8\jpype\_pyinstaller
    copying jpype\_core.pyi -> build\lib.win32-3.8\jpype
    copying jpype\_jcollection.pyi -> build\lib.win32-3.8\jpype
    copying jpype\_jio.pyi -> build\lib.win32-3.8\jpype
    copying jpype\_jstring.pyi -> build\lib.win32-3.8\jpype
    copying jpype\_jthread.pyi -> build\lib.win32-3.8\jpype
    running build_ext
    Call build extensions
    Using Jar cache
    copying native\jars\org.jpype.jar -> build\lib.win32-3.8
    Call build ext
    building '_jpype' extension
    creating build\temp.win32-3.8
    creating build\temp.win32-3.8\Release
    creating build\temp.win32-3.8\Release\native
    creating build\temp.win32-3.8\Release\native\common
    creating build\temp.win32-3.8\Release\native\python
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DWIN32=1 -Inative\common\include -Inative\
python\include -Inative\embedded\include -Inative\jni_include "-Ic:\program files (x86)\python 3.8.5\include" "-Ic:\program files (x86)\python 3.8.5\include" "-IC:\Program Files (x86)\Microsoft V
isual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x8
6)\Windows Kits\10\Include\10.0.10240.0\ucrt" /EHsc /Tpnative\common\jp_array.cpp /Fobuild\temp.win32-3.8\Release\native\common\jp_array.obj /Zi /EHsc /std:c++14
    jp_array.cpp
    c:\program files (x86)\python 3.8.5\include\pyconfig.h(206): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory.
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files (x86)\python 3.8.5\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\nakanov\\AppData\\Lo
cal\\Temp\\pip-install-1_cw9km2\\jpype1_abb3802e6dfd4c54b583d9883ffd5d06\\setup.py'"'"'; __file__='"'"'C:\\Users\\nakanov\\AppData\\Local\\Temp\\pip-install-1_cw9km2\\jpype1_abb3802e6dfd4c54b583d
9883ffd5d06\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().repl
ace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\nakanov\AppData\Local\Temp\pip-record-tt0zqrwa\install-record.txt' --single-v
ersion-externally-managed --user --prefix= --compile --install-headers 'C:\Users\nakanov\AppData\Roaming\Python\Python38\Include\JPype1' Check the logs for full command output.

答案1

由于某些未知原因,此 JPype 依赖项与我的机器不兼容。Jaydebeapi 的此特定依赖项 (JPype) 出现错误。我使用以下命令进行了 JPype 降级:

pip install --force-reinstall JPype1==0.6.3

然后我运行命令来安装 jaydebeapi。

pip install jaydebeapi==1.2.3

相关内容