原因

openai库版本过旧

解决办法(二选一)

  1. pip install -U openai
  2. 下载安装包放入你的项目根目录下,

    改名格式zip为whl(即:openai-0.27.0-py3-none-any.zipopenai-0.27.0-py3-none-any.whl

    终端执行pip install openai-0.27.0-py3-none-any.whl

目的就是更新你的openai,选择其中一种办法即可。

AttributeError: module 'openai' has no attribute 'ChatCompletion'的解决办法的更多相关文章

  1. 对于AttributeError: 'Flask' object has no attribute 'cli'的解决办法

    版权声明:本文为博主原创文章,未经博主允许不得转载. 环境flask-script2.0.5.flask0.10.1 运行官方文档sample 出现问题 c:\kk\flask\examples\fl ...

  2. 【Python 脚本报错】AttributeError: 'module 'yyy' has no attribute 'xxx'的解决方法

    先参考这篇记录大概理解了原因, 再深入了解下python的import机制, 发现自己的模块之间存在互相import. 比如,A.py中import B,而B.py中也import A了, 现在执行模 ...

  3. AttributeError: 'module' object has no attribute 'X509_up_ref'

    主要报错: AttributeError: 'module' object has no attribute 'X509_up_ref' 1 解决办法 卸载再重装pyOpenSSL pip unins ...

  4. python出现AttributeError: module ‘xxx’ has no attribute ‘xxx’错误时,两个解决办法

    运行python程序时,也许会出现这样的错误:AttributeError: module ‘xxx’ has no attribute ‘xxx’: 解决该错误有两种方法 1.手动安装该模块 2.检 ...

  5. python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?

    python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...

  6. Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法

    最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...

  7. attributeError:'module' object has no attribute ** 解决办法

    写了一个小脚本,执行的时候报错: Traceback (most recent call last): File "F:/test/qrcode.py", line 109, in ...

  8. AttributeError: 'module' object has no attribute 'TornadoAsyncNotifier'

    /*************************************************************************** * AttributeError: 'modu ...

  9. AttributeError: 'module' object has no attribute 'Thread'

    $ python thread.py starting at: 2015-08-05 00:24:24Traceback (most recent call last):  File "th ...

  10. AttributeError: module 'enum' has no attribute 'IntFlag'

    Mac PyCharm新建以Python3.6.1为解释器的Django项目的时候出现以下错误提示: AttributeError: module 'enum' has no attribute 'I ...

随机推荐

  1. nuxt.js安装使用

    首先要学会看文档,https://www.nuxtjs.cn/guide/configuration 一.创建项目,并运行 终端运行 npx create-nuxt-app <项目名> ( ...

  2. RestTemplate获取json数组

    1.需求描述 接口返回的是一个json数组,要获取到接口返回值并用实体类list接住. 2.解决方法 使用springboot框间自带的Http的工具类RestTemplate调接口,其返回值用hut ...

  3. “It is required that your private key files are NOT accessible by others. This private key will be ignored.”

    Windows Terminal 通过密钥登录远程vps时提示: "It is required that your private key files are NOT accessible ...

  4. Java入门与进阶P-5.3+P-5.4

    数组的元素 有效的下标 最小的下标是0,最大的下标是数组的元素个数-1 可是编译器不会检查看你是否用了有效的下标 但是如果运行的时候出现了无效的下标,可能会导致程序终止 定义数组变量 元素个数必须是整 ...

  5. 浅谈JS词法环境

    JavaScript 词法环境 本文主要讲解JS词法环境,我们将看到什么是词法环境,词法范围如何工作,函数内部的名称如何解析,内部属性,弄清楚词法环境利于我们理解闭包.让我们开始吧... 什么是词法环 ...

  6. 使用 shell 脚本拼接 srt 字幕文件 (srtcat)

    背景 前段时间迷上了做 B 站视频,主要是摩托车方面的知识分享.做的也比较粗糙,就是几张图片配上语音和字幕进行解说.尝试过自己解说,发现录制视频对节奏的要求还是比较高的,这里面水太深把握不住.好在以 ...

  7. 云端智创 | 批量化生产,如何利用Timeline快速合成短视频?

    本文内容整理自「智能媒体生产」系列课程第三讲:开发者实战,由阿里云智能视频云技术专家分享云剪辑Timeline的功能及使用方法.云剪辑OpenAPI的使用流程.短视频批量生产的基本原理以及使用Time ...

  8. Docker安装SqlServer、Mysql、MariaDB

    一.Docker 安装SqlServer 说明 1. 拉取镜像 docker pull mcr.microsoft.com/mssql/server:2019-latest 2.运行 docker r ...

  9. P25_wxss - rpx单位

    模板样式 - rpx 什么是 rpx 尺寸单位 rpx(responsive pixel)是微信小程序独有的,用来解决屏适配的尺寸单位. rpx 的实现原理 rpx 的实现原理非常简单:鉴于不同设备屏 ...

  10. 三分钟实战手写Spring Boot Starter

    1 背景 在平时的开发中,开发的同学会把一些通用的方法,写成一个工具类,例如日期转换的,JSON转换的等等,方便业务后续调用,使代码更容易维护. 如果一些更常用的方法,例如鉴权的,加解密的等等,几乎每 ...