主要是想成功运行下面这个安装步骤
https://huggingface.co/transformers/installation.html#installing-from-source
一、进入环境
conda activate pytorch
二、因为mac没有gpu,只能安装cpu版本的
pip install transformers[torch]
一开始我忘记进入pytorch环境,在base下是可以成功安装的,但是进入后就不行,原因是zsh兼容问题
三、报错信息:zsh:no matches found*****
终端输入
vim ~/.zshrc
#输入i进入编辑模式 在文件中输入如下一行
setopt no_nomatch
#按esc退出编辑模式,输入:wq
#保存并更新配置
source ~/.zshrc
四、terminal运行python -c “from transformers import pipeline; print(pipeline(‘sentiment-analysis’)(‘I hate you’))”
当然也会报错
要添加镜像的
python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I hate you'))" -i https://mirrors.aliyun.com/pypi/simple/