#1198 ModuleNotFoundError: No module named 'openai'

104.28* Posted at: 3 days ago 👁24

Traceback (most recent call last):
File "/Users/tips/voice/pyvideotrans/videotrans/task/job.py", line 146, in run

trk.trans()

File "/Users/tips/voice/pyvideotrans/videotrans/task/_translate_srt.py", line 45, in trans

raw_subtitles = run(

File "/Users/tips/voice/pyvideotrans/videotrans/translator/__init__.py", line 844, in run

from videotrans.translator._google import Google

File "/Users/tips/voice/pyvideotrans/videotrans/translator/_google.py", line 7, in

from tenacity import retry, stop_after_attempt, wait_fixed, retry_if_not_exception_type, before_log, after_log

ModuleNotFoundError: No module named 'tenacity'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/tips/voice/pyvideotrans/videotrans/task/job.py", line 155, in run

from videotrans.configure._except import get_msg_from_except

File "/Users/tips/voice/pyvideotrans/videotrans/configure/_except.py", line 5, in

from openai import AuthenticationError, PermissionDeniedError, NotFoundError, BadRequestError, RateLimitError, \

ModuleNotFoundError: No module named 'openai'


=
system:macOS-26.0.1-arm64-arm-64bit
version:v3.82
frozen:False
language:zh
root_dir:/Users/tips/voice/pyvideotrans
Python: 3.10.19 (main, Oct 9 2025, 15:25:03) [Clang 17.0.0 (clang-1700.3.19.1)]

1 Replies

这个错误是由于缺少必要的Python依赖包导致的。从错误信息看,系统缺少 tenacityopenai 模块。

解决方案:

  1. 重新安装依赖包(推荐):

    • 在终端中进入您的pyVideoTrans源码目录:cd /Users/tips/voice/pyvideotrans
    • 运行安装命令:pip install -r requirements.txt
  2. 如果上述方法无效,手动安装缺失的包

    • pip install tenacity openai
  3. 检查Python环境

    • 确保您使用的是正确的Python环境,特别是如果您使用了虚拟环境
    • 确认pip指向的是与Python 3.10.19对应的版本
  4. 重新启动软件

    • 安装完依赖后,重新启动pyVideoTrans

如果问题仍然存在,请确认requirements.txt文件是否完整,或者尝试重新克隆项目源码并重新安装所有依赖。

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Donate: https://ko-fi.com/jianchang512

Trending Questions