[英]Pip install results in this error " cl.exe' failed with exit code 2 "
我已經閱讀了關於此錯誤的所有其他問題,但令人沮喪的是,沒有一個提供有效的解決方案。
如果我在 cmd 行中運行pip install sentencepiece
,它會給出以下 output。
src/sentencepiece/sentencepiece_wrap.cxx(2809): fatal error C1083: Cannot open include file: 'sentencepiece_processor.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
我正在運行 python 3.10.1 和 pip 22.0.3。
*我的 windows 機器上有以下 Microsoft Visual C++ 程序,我剛剛完成了全新安裝,因為它抱怨沒有特定的 C++ 程序。 微軟VC++
我什至將 .exe 文件添加到我的 PATH 變量中,但我仍然遇到同樣的錯誤。
我的電腦上是否缺少特定的 Microsoft 程序?
用python3.10
Windows上:首先install vcpkg and install sentencepiece:x64-windows-static
將 header 和 lib 文件從vcpkg/installed/x64-windows-static/include
和 lib 復制到
C:/Program Files/python310/build/root/include
and lib
這應該可以正常工作,因為 setup.py 安裝期望庫位於 ..\build\root\lib 目錄中。
由於 C:\Program Files\python310\lib 在 /LIBPATH 中,因此生成的 ..\build\root\lib 將指向 sentencepiece.lib
如果仍然遇到錯誤,則設置 INCLUDE 和 LIB 環境變量,以便從pip install sentencetransformers
調用的 cl.exe 找到它們。
擁有 windows+python 3.10 env 的人,這里是通過 vcpkg 安裝它的確切步驟。
zweistein 的回答中涵蓋了其他說明。
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install sentencepiece:x64-windows-static
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.