我尝试使用 pip install hydra 在 Windows 上安装 hydra。 一开始的问题是
Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
安装 microsoft c++ 构建工具后,出现另一个错误,搜索后我找不到解决方案。
" command 'C:\\Program Files (x86)\\Microsoft VisualStudio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2"
完整的错误信息:
Collecting hydra
Using cached Hydra-2.5.tar.gz (82 kB)
Using legacy 'setup.py install' for hydra, since package 'wheel' is not installed.
Installing collected packages: hydra
Running setup.py install for hydra ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\t-jialugao\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\t-jialugao\\AppData\\Local\\Temp\\pip-install-iebkgua6\\hydra_31820ebba80444a6a93dd04f59908cf9\\setup.py'"'"'; __file__='"'"'C:\\Users\\t-jialugao\\AppData\\Local\\Temp\\pip-install-iebkgua6\\hydra_31820ebba80444a6a93dd04f59908cf9\\setup.py'"'"';f = getattr(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\t-jialugao\AppData\Local\Temp\pip-record-0imsi2rz\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\t-jialugao\appdata\local\programs\python\python39\Include\hydra'
cwd: C:\Users\t-jialugao\AppData\Local\Temp\pip-install-iebkgua6\hydra_31820ebba80444a6a93dd04f59908cf9\
Complete output (37 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
copying src\hydra.py -> build\lib.win-amd64-3.9
running build_ext
building '_hydra' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\t-jialugao\AppData\Local\Temp\pip-install-iebkgua6\hydra_31820ebba80444a6a93dd04f59908cf9\src -Ic:\users\t-jialugao\appdata\local\programs\python\python39\include -Ic:\users\t-jialugao\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tcsrc/MurmurHash3.c /Fobuild\temp.win-amd64-3.9\Release\src/MurmurHash3.obj -std=gnu99 -O2 -D_LARGEFILE64_SOURCE
cl : Command line warning D9002 : ignoring unknown option '-std=gnu99'
MurmurHash3.c
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\t-jialugao\AppData\Local\Temp\pip-install-iebkgua6\hydra_31820ebba80444a6a93dd04f59908cf9\src -Ic:\users\t-jialugao\appdata\local\programs\python\python39\include -Ic:\users\t-jialugao\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tcsrc/_hydra.c /Fobuild\temp.win-amd64-3.9\Release\src/_hydra.obj -std=gnu99 -O2 -D_LARGEFILE64_SOURCE
cl : Command line warning D9002 : ignoring unknown option '-std=gnu99'
_hydra.c
src/_hydra.c(1621): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src/_hydra.c(2668): warning C4267: '=': conversion from 'size_t' to 'char', possible loss of data
src/_hydra.c(3377): warning C4018: '<': signed/unsigned mismatch
src/_hydra.c(6964): warning C4244: 'function': conversion from 'unsigned __int64' to 'unsigned long', possible loss of data
src/_hydra.c(7072): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src/_hydra.c(7103): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src/_hydra.c(7316): warning C4267: 'function': conversion from 'size_t' to 'unsigned int', possible loss of data
src/_hydra.c(8530): error C2039: 'tp_print': is not a member of '_typeobject'
c:\users\t-jialugao\appdata\local\programs\python\python39\include\cpython/object.h(193): note: see declaration of '_typeobject'
src/_hydra.c(8535): error C2039: 'tp_print': is not a member of '_typeobject'
c:\users\t-jialugao\appdata\local\programs\python\python39\include\cpython/object.h(193): note: see declaration of '_typeobject'
src/_hydra.c(8539): error C2039: 'tp_print': is not a member of '_typeobject'
c:\users\t-jialugao\appdata\local\programs\python\python39\include\cpython/object.h(193): note: see declaration of '_typeobject'
src/_hydra.c(8551): error C2039: 'tp_print': is not a member of '_typeobject'
c:\users\t-jialugao\appdata\local\programs\python\python39\include\cpython/object.h(193): note: see declaration of '_typeobject'
src/_hydra.c(9924): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
src/_hydra.c(9940): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
src/_hydra.c(11521): warning C4996: 'PyCFunction_Call': deprecated in 3.9
src/_hydra.c(11586): warning C4996: 'PyCFunction_Call': deprecated in 3.9
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\t-jialugao\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\t-jialugao\\AppData\\Local\\Temp\\pip-install-iebkgua6\\hydra_31820ebba80444a6a93dd04f59908cf9\\setup.py'"'"'; __file__='"'"'C:\\Users\\t-jialugao\\AppData\\Local\\Temp\\pip-install-iebkgua6\\hydra_31820ebba80444a6a93dd04f59908cf9\\setup.py'"'"';f = getattr(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\t-jialugao\AppData\Local\Temp\pip-record-0imsi2rz\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\t-jialugao\appdata\local\programs\python\python39\Include\hydra' Check the logs for full command output.
答案 0 :(得分:0)
tp_print
方法已从 Python 3.8 的 API 中删除。错误“'tp_print': is not a member of '_typeobject'”意味着该代码适用于 Python <= 3.8。降级到 Python 3.8 并重试。
https://pypi.org/project/Hydra/, last release 2.5 是在 2016 年 8 月 3 日。支持的 Python 版本列表是:2.7、3.4、3.5。
答案 1 :(得分:0)
通过运行 whl
tar
手动安装,更多此类文件可能适合您!