OpenAI 未在 google colab 中导入

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

我成功在Google安装了open AI

colab
;但是,我无法导入它...我安装了最新版本的 OpenAI(和打字扩展)...

这是错误:

ImportError                               Traceback (most recent call last)
<ipython-input-20-390a346bb18c> in <cell line: 1>()
----> 1 import openai

5 frames
/usr/local/lib/python3.10/dist-packages/openai/_utils/_streams.py in <module>
      1 from typing import Any
----> 2 from typing_extensions import Iterator, AsyncIterator
      3 
      4 
      5 def consume_sync_iterator(iterator: Iterator[Any]) -> None:

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

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

python google-colaboratory openai-api
1个回答
0
投票

您可以尝试升级openai:

!pip install --upgrade openai

或者卸载并重新安装:

!pip uninstall -y openai
!pip install openai
© www.soinside.com 2019 - 2024. All rights reserved.