原因

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. 控制台运行java

    控制台执行java 新建java代码 新建一个记事本文件,将文件名改为HelloWorld.java,注意:后缀是.java. 若没有显示文件后缀,可以在资源管理器打开显示后缀,然后再次修改文件名,一 ...

  2. Profiler导致的严重性能问题

    背景 客户反馈系统突然运行非常缓慢,持续了近20分钟的时间,通过SQL专家云定位到有人开启了Profiler导致,但是不能定位是谁开启的,请我们协助分析. 现象  登录SQL专家云,进入实时可视化页面 ...

  3. 一文了解 Dubbo 3 配置工作原理

    以下是一个 Dubbo 属性配置的例子 dubbo-spring-boot-samples ## application.properties # Spring boot application sp ...

  4. [Leetcode]在排序数组中查找元素的第一个和最后一个位置

    题目 代码 class Solution { public: vector<int> searchRange(vector<int>& nums, int target ...

  5. P8865 [NOIP2022] 种花

    简要题意 \(T\) 组数据,给你一个 \(n\times m\) 的 \(01\) 矩阵. \(0\) 部分可以组成 \(A_c\) 个 \(\texttt{C}\) 型图案和 \(A_f\) 个 ...

  6. (14)go-micro微服务服务层Handle开发

    目录 一 Handle层开发功能说明 需要完成的服务开发功能: 从哪找需要开发的功能 二 代码编写 三 最后 一 Handle层开发功能说明 需要完成的服务开发功能: 登录 注册 查询用户信息 修改信 ...

  7. 多行文字自动换行居中--实测好用的很OK

    实测好用的很~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...

  8. 合并JSON文件

    下面是一段简单地代码 用来减少工作量合并代码 <!DOCTYPE html> <html lang="en"> <head> <meta ...

  9. 我为什么要放弃RESTful,选择拥抱GraphQL

    背景 REST作为一种现代网络应用非常流行的软件架构风格,自从Roy Fielding博士在2000年他的博士论文中提出来到现在已经有了20年的历史.它的简单易用性,可扩展性,伸缩性受到广大Web开发 ...

  10. Containerd NRI 插件

    Github:https://github.com/containerd/nri.git Slide:https://static.sched.com/hosted_files/kccncna2022 ...