我正在尝试在python中安装pytrec_eval库,并抛出以下错误
pip install pytrec_eval
Collecting pytrec_eval
Using cached pytrec_eval-0.5.tar.gz (15 kB)
Preparing metadata (setup.py) ... done
Installing collected packages: pytrec_eval
DEPRECATION: pytrec_eval is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for pytrec_eval ... error
error: subprocess-exited-with-error
× Running setup.py install for pytrec_eval did not run successfully.
│ exit code: 1
╰─> [15 lines of output]
Fetching trec_eval from https://github.com/usnistgov/trec_eval/archive/v9.0.8.tar.gz.
C:UserscAppDataLocalProgramsPythonPython311Libsite-packagessetuptoolsdist.py:771: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running install
C:UserscAppDataLocalProgramsPythonPython311Libsite-packagessetuptoolscommandinstall.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating buildlib.win-amd64-cpython-311
creating buildlib.win-amd64-cpython-311pytrec_eval
copying py__init__.py -> buildlib.win-amd64-cpython-311pytrec_eval
running build_ext
building 'pytrec_eval_ext' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pytrec_eval
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
我已尝试安装下列程序,并重新运行命令,但没有成功。
cmake
Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
pip install trectools --user
我系统:
Windows 10- Python 3.8.11和Python 3.11.0(两个不同的envs失败)
- Visual Studio Code
根据这一行:
错误:需要Microsoft Visual c++ 14.0或更高版本。得到它微软c++构建工具:https://visualstudio.microsoft.com/visual-cpp-build-tools/
你需要安装Microsoft Visual c++ 14.0.