欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > python >内容正文

python

Python - 安装sentencepiece异常

发布时间:2023/12/16 python 46 豆豆
生活随笔 收集整理的这篇文章主要介绍了 Python - 安装sentencepiece异常 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

在安装transformers库时,sentencepiece无法安装,如下:

pip3 install --user transformers

解决问题参考:Pip install sentencepiece failure

在安装sentencepiece,无法进行,如下:

Building wheels for collected packages: sentencepieceBuilding wheel for sentencepiece (setup.py) ...

长时间等待,异常如下:

./build_bundled.sh:行15: cmake: 未找到命令make: *** 没有指明目标并且找不到 makefile。 停止。make: *** 没有规则可以创建目标“install”。 停止。Package sentencepiece was not found in the pkg-config search path.Perhaps you should add the directory containing `sentencepiece.pc'to the PKG_CONFIG_PATH environment variableNo package 'sentencepiece' foundFailed to find sentencepiece pkg-config----------------------------------------ERROR: Failed building wheel for sentencepiece

单独安装sentencepiece,也会出现异常。

pip3 install --user sentencepiece

下载sentencepiece的对应版本

sentencepiece

例如,CentOS 7对应的版本:

下载之后,安装

pip3 install --user sentencepiece-0.1.94-cp37-cp37m-manylinux2014_x86_64.whl

提示错误:平台版本不对,如下。

ERROR: sentencepiece-0.1.94-cp37-cp37m-manylinux2014_x86_64.whl is not a supported wheel on this platform. WARNING: You are using pip version 19.2.3, however version 20.2.4 is available. You should consider upgrading via the 'pip install --upgrade pip' command.

修改python库的命名方式,manylinux2014 ->linux, 即可:

mv sentencepiece-0.1.94-cp37-cp37m-manylinux2014_x86_64.whl sentencepiece-0.1.94-cp37-cp37m-linux_x86_64.whl

再次安装,即可:

pip3 install --user sentencepiece-0.1.94-cp37-cp37m-linux_x86_64.whl

最后安装transformers,即可

pip3 install --user transformers

总结

以上是生活随笔为你收集整理的Python - 安装sentencepiece异常的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。