Transformers库安装报错

安装Transformers库用来调取最新的深度学习模型(NLP)

 

安装时报错:

 ERROR: Command errored out with exit status 1:

 If you are using an outdated pip version, it is possible a prebuilt wheel is available for
this package but pip is not able to install from it. Installing from the wheel would avoid
the need for a Rust compiler.

 To update pip, run:

     pip install --upgrade pip

 and then retry package installation.

 If you did intend to build this package from source, try installing a Rust compiler from
your system package manager and ensure it is on the PATH during installation.
Alternatively, rustup (available at https://rustup.rs) is the recommended way to download
and update the Rust compiler toolchain.
 ----------------------------------------

按提示进行更新:pip install --upgrade pip,但是没有效果,显示Requirement already satisfied

按照提示安装rustup,安装后新的报错出现了:

 error: linker `link.exe` not found
   |
   = note: program not found

 note: the msvc targets depend on the msvc linker but `link.exe` was not found

 note: please ensure that VS 2013, VS 2015, VS 2017, VS 2019 or VS 2022 was installed with the Visual C++ option

提示说没有微软MS VC++编译环境的链接程序linker.exe,需要 VS 2013, VS 2015, VS 2017 or VS 2019或其他版本的VC++编译器,看了网上的解决方案,安装了Visual Studio 2019 生成工具Visual Studio 2019 build tools,下载build tools之后,在Visual studio installer中只选择“C++生成工具”,然后只选择"MSVC v142 - VS2019 C++ x64/x86 生成工具"

注意要在VS中登录一下微软账号,否则依然会报错。

解决了这一难题后,新的报错再次出现

warning: spurious network error (2 tries remaining): failed to send request: 鎿嶄綔瓒呮椂
; class=Os (2)
warning: spurious network error (1 tries remaining): failed to send request: 鎿嶄綔瓒呮椂
; class=Os (2)
error: failed to get `env_logger` as a dependency of package `tokenizers-python v0.11.0

尝试了三种方法,第一种删掉了~/.cargo/registry/index,第二种直接输入命令

 rustup toolchain install stable-x86_64-pc-windows-gnu
 rustup default stable-x86_64-pc-windows-gnu

但是两种方法都无效,仍然提示linker `link.exe` not found,因此尝试了第三种方法

之前安装是只安装了"MSVC v142 - VS2019 C++ x64/x86 生成工具",这一次把下面两项也安装上了,Windows 10 SDK应该是必须要安装的

好,这个问题终于解决了,下面来到了本次任务的终极问题——

ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot
accurately determine which files belong to it which would lead to only a partial uninstall.

提示说环境中已经存在某个版本的PyYAML,因此需要重新安装PyYAML,输入指令pip install PyYAML --ignore-installed,然后再重新安装一次Transformers,成功啦!!

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值