Python - 安装sentencepiece异常

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

pip3 install --user transformers

解决问题参考:Pip install sentencepiece failure

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

Building wheels for collected packages: sentencepiece
  Building 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 variable
  No package 'sentencepiece' found
  Failed to find sentencepiece pkg-config
  ----------------------------------------
  ERROR: Failed building wheel for sentencepiece

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

pip3 install --user sentencepiece

下载sentencepiece的对应版本

sentencepiece

例如,CentOS 7对应的版本:
CentOS
下载之后,安装

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
  • 16
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 17
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Caroline S

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值