复制Openai的代码进行测试的时候,发生:Import "openai" could not be resolvedPylance
reportMissingImports
以为是安装问题,检查安装,发现没有这个模块:
直接进行安装:pip install openai;报错:
No matching distribution found for pandas>=1.2.3 (from openai)
You are using pip version 10.0.1, however version 23.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
所以,需要进行先升级:python -m pip install --upgrade pip
大约1分钟后,安装完成:
如此,引入openai语句下不再出现提示,即表示成功引入:
再次输入 python -v后,再输入 import openai,查看模块是否存在及路径,发现已有,完成解决。