代码(来自googletrans import Translator(显示以下错误:
Traceback (most recent call last): File "/Users/cadeylange/Documents/python_work/Personal/frequently_used_words.py", line 2, in <module> from googletrans import Translator ModuleNotFoundError: No module named 'googletrans' [Finished in 0.3s with exit code 1] [cmd: ['/usr/local/bin/python3', '-u', '/Users/cadeylange/Documents/python_work/Personal/frequently_used_words.py']] [dir: /Users/cadeylange/Documents/python_work/Personal] [path: /Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]
我已经仔细检查了谷歌翻译是否已使用 pip 成功安装,并且它已经安装。我想不出为什么代码不起作用,我尝试使用不同的表达式导入它,包括基本的"import googletrans"语句。有人能看到问题吗?
阅读回溯显示,您正在Linux上运行Python 3,对吗?您是否尝试过使用 pip3 安装模块,什么应该使其可用于 Python 3。