gpt4 book ai didi

python - 将openai导入python时出错

转载 作者:行者123 更新时间:2023-12-02 05:46:50 24 4
gpt4 key购买 nike

我使用这个命令安装了 openai:

pip install openai

当我import openai时,我遇到了这种错误。

我该如何解决这个问题?

Traceback (most recent call last):
File "test_1.py", line 1, in <module>
import openai
File "/home/nadun/.local/lib/python2.7/site-packages/openai/__init__.py", line 30, in <module>
from openai.api_resources import * # noqa
File "/home/nadun/.local/lib/python2.7/site-packages/openai/api_resources/__init__.py", line 1, in <module>
from openai.api_resources.completion import Completion
File "/home/nadun/.local/lib/python2.7/site-packages/openai/api_resources/completion.py", line 14
def create(cls, *args, timeout=None, **kwargs):
^
SyntaxError: invalid syntax

最佳答案

我遇到了这个问题,但这是由于 python 的版本。

升级到python3.10后问题解决

关于python - 将openai导入python时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74750959/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com