导入错误:无法从“huggingface_hub”导入名称“hf_hub_download”

问题描述 投票:0回答:1

问题

我需要 DeepLabCut 的 conda 环境,我设置了它并打开 python 控制台,但我无法导入

from huggingface_hub import hf_hub_download

场景

下面是我的控制台输出的示例

(base) user@macbook ~ % conda activate TEST_ENV                                                 
(TEST_ENV) user@macbook ~ % python
Python 3.9.18 (main, Sep 11 2023, 08:38:23) 
[Clang 14.0.6 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import huggingface_hub
>>> from huggingface_hub import hf_hub_download
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'hf_hub_download' from 'huggingface_hub' (/usr/local/anaconda3/envs/TEST_ENV/lib/python3.9/site-packages/huggingface_hub/__init__.py)
>>> 

奇怪的事实是,我可以使用

huggingface_hub
导入父模块,因此只有当我尝试导入名为
hf_hub_download

的子模块时才会出现此错误

也尝试过

重新安装 anaconda,启动

conda clean --all
,更改环境

非常感谢您的关注。

python-3.x macos pip conda
1个回答
0
投票

需要安装chardet

conda install chardet

© www.soinside.com 2019 - 2024. All rights reserved.