简体   繁体   English

Python 脚本中“pdf2image”的模块未找到错误

[英]Module Not Found Error for 'pdf2image' in Python Script

I am working on a project to extract text from a bunch of scanned PDF's.我正在做一个从一堆扫描的 PDF 中提取文本的项目。 I am following this tutorial .我正在关注本教程 One of the first steps involves importing modules.第一步涉及导入模块。 I'm having some trouble importing 'pdf2image'.我在导入“pdf2image”时遇到了一些问题。 For context, I'm using a Conda environment called, "textExtractor" in VS Code's Python terminal.对于上下文,我在 VS Code 的 Python 终端中使用名为“textExtractor”的 Conda 环境。 I checked if pdf2image was installed by running "Conda list" and it looks to be installed.我通过运行“Conda list”检查了 pdf2image 是否已安装,它看起来已安装。 However, when I run the python script I get an error saying,但是,当我运行 python 脚本时,我收到一条错误消息,

(textExtractor) C:\\Users\\mhiebing\\Documents\\GitHub_Repos\\MonthlyStatsExtract>C:/Users/mhiebing/Anaconda3/python.exe c:/Users/mhiebing/Documents/GitHub_Repos/MonthlyStatsExtract/PDF_to_Image.py (textExtractor) C:\\Users\\mhiebing\\Documents\\GitHub_Repos\\MonthlyStatsExtract>C:/Users/mhiebing/Anaconda3/python.exe c:/Users/mhiebing/Documents/GitHub_Repos/MonthlyStatsExtract/PDF_to_Image.py

Traceback (most recent call last): File "c:/Users/mhiebing/Documents/GitHub_Repos/MonthlyStatsExtract/PDF_to_Image.py", line 1, in from pdf2image import convert_from_path, convert_from_bytes回溯(最近一次通话):文件“c:/Users/mhiebing/Documents/GitHub_Repos/MonthlyStatsExtract/PDF_to_Image.py”,第 1 行,在 from pdf2image import convert_from_path, convert_from_bytes

ModuleNotFoundError: No module named 'pdf2image' ModuleNotFoundError: 没有名为“pdf2image”的模块

Below is a screenshot showing pdf2image and the error:以下是显示 pdf2image 和错误的屏幕截图: 在此处输入图片说明

Any idea what's going wrong?知道出了什么问题吗?

The python interpreter you selected is not the textExtractor but the mhiebing .您选择的 python 解释器不是textExtractor而是mhiebing

在此处输入图片说明

You can click the Status Bar of interpreter to switch the interpreter.您可以单击解释器的状态栏来切换解释器。 And you can refer to the official docs for more details.您可以参考官方文档了解更多详情。

It looks like you type the command to run the file, it's not recommended.看起来您键入命令来运行文件,不建议这样做。 You can click the green triangle button on the top right corner or the F5 to debug it.可以点击右上角的绿色小三角按钮或者F5进行调试。 If you do that you can find out the truthly environment you are taking.如果你这样做,你就可以找出你正在接受的真实环境。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM