Google colab 上的羊驼:无法从“typing_extensions”导入名称“TypeAliasType”

Alpaca on Google colab: cannot import name 'TypeAliasType' from 'typing_extensions'

提问人:JobHunter69 提问时间:10/31/2023 更新时间:10/31/2023 访问量:757

问:

我正在尝试在 google colab 上使用羊驼(交易平台)。它在我的笔记本电脑上本地工作,但我收到以下错误:

ImportError                               Traceback (most recent call last)
<ipython-input-4-791aac88b96e> in <cell line: 16>()
     14 # from alpaca.data.historical import CryptoHistoricalDataClient
     15 
---> 16 from alpaca.data.historical import StockHistoricalDataClient
     17 
     18 import alpaca

9 frames
/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_typing_extra.py in <module>
     11 from typing import TYPE_CHECKING, Any, ForwardRef
     12 
---> 13 from typing_extensions import Annotated, Final, Literal, TypeAliasType, TypeGuard, get_args, get_origin
     14 
     15 if TYPE_CHECKING:

ImportError: cannot import name 'TypeAliasType' from 'typing_extensions' (/usr/local/lib/python3.10/dist-packages/typing_extensions.py)

有谁知道是什么原因造成的?

在我遇到此错误之前,这是我在 colab 中唯一的行:

!pip install transformers
!pip install alpaca-py    
from alpaca.data.historical import StockHistoricalDataClient
python-3.x google-colaboratory 类型别名 羊驼

评论


答:

1赞 Ahmed Shokry 10/31/2023 #1

只需删除运行时,然后再次运行实现即可。

评论

0赞 JobHunter69 10/31/2023
哦,哇,它奏效了