我正在尝试在 Jupyter 笔记本中运行
subprocess.run(["huggingface-cli", "login", "--token", TOKEN])
,它可以在 Mac 上运行,但在 Ubuntu 上出现以下错误。我检查了pip install huggingface_hub
已被执行。
subprocess.run(["git", "lfs", "install"])
有效。
!huggingface-cli login
在 jupyter 单元格中得到错误/bin/bash: huggingface-cli: command not found
有人可以帮忙吗?
你的
huggingface_hub
不在你的Ubuntu
系统的路径env变量中,它在你的jupyter
和你的terminal
会话之间是不一样的
在这里你可以做什么,获取可执行文件的
path
pip show huggingface_hub | grep Location
然后更新你的jupyter笔记本中的路径,例如:
import os
import sys
import subprocess
huggingface_bin_path = "/home/user/.local/bin"
os.environ["PATH"] = f"{huggingface_bin_path}:{os.environ['PATH']}"
subprocess.run(["huggingface-cli", "login", "--token", TOKEN])
用正确的替换
/home/user/.local/bin
和TOKEN
,然后它应该工作