import openai
Traceback (most recent call last):
File "f:\python\python35-32\lib\site-packages\IPython\core\interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-1dc3a902d00c>", line 1, in <module>
import openai
File "f:\python\python35-32\lib\site-packages\openai\__init__.py", line 30, in <module>
from openai.api_resources import * # noqa
File "f:\python\python35-32\lib\site-packages\openai\api_resources\__init__.py", line 1, in <module>
from openai.api_resources.completion import Completion
File "f:\python\python35-32\lib\site-packages\openai\api_resources\completion.py", line 5, in <module>
from openai.api_resources.abstract.engine_api_resource import EngineAPIResource
File "f:\python\python35-32\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 46
**params,
^
SyntaxError: invalid syntax
这个错误提示显示 SyntaxError: invalid syntax
,这通常是由于Python版本不兼容造成的问题,而OpenAI库可能需要在较新的Python版本上运行。
建议您检查您当前Python版本是否符合OpenAI库的要求。
OpenAI官方文档建议使用Python 3.6或更高版本,建议您将Python更新到最新版本,并尝试再次导入OpenAI库。