首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ModuleNotFoundError:没有名为“pdfplumber”的模块

ModuleNotFoundError:没有名为“pdfplumber”的模块
EN

Stack Overflow用户
提问于 2021-02-25 10:50:32
回答 1查看 1.9K关注 0票数 0

我想导入pdfplumber并尝试

代码语言:javascript
运行
复制
import pdfplumber

并捕获到错误:

代码语言:javascript
运行
复制
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-b3d6737fd8e1> in <module>
----> 1 import pdfplumber

ModuleNotFoundError: No module named 'pdfplumber'

尝试使用pip3 install pdfplumber进行安装,结果返回:

代码语言:javascript
运行
复制
Requirement already satisfied: pdfplumber in c:\python38\lib\site-packages (0.5.26)
Requirement already satisfied: pdfminer.six==20200517 in c:\python38\lib\site-packages (from pdfplumber) (20200517)
Requirement already satisfied: Wand in c:\python38\lib\site-packages (from pdfplumber) (0.6.5)
Requirement already satisfied: Pillow>=7.0.0 in c:\python38\lib\site-packages (from pdfplumber) (7.2.0)
Requirement already satisfied: sortedcontainers in c:\python38\lib\site-packages (from pdfminer.six==20200517->pdfplumber) (2.3.0)
Requirement already satisfied: chardet in c:\users\harper.guo\appdata\roaming\python\python38\site-packages (from pdfminer.six==20200517->pdfplumber) (3.0.4)
Requirement already satisfied: pycryptodome in c:\python38\lib\site-packages (from pdfminer.six==20200517->pdfplumber) (3.10.1)
WARNING: You are using pip version 20.3.3; however, version 21.0.1 is available.
You should consider upgrading via the 'c:\python38\python.exe -m pip install --upgrade pip' command.

但是命令提示符显示我已经安装了该模块?

代码语言:javascript
运行
复制
>>> pdfplumber
<module 'pdfplumber' from 'C:\\Python38\\lib\\site-packages\\pdfplumber\\__init__.py'>

但是import pdfplumber返回了相同的错误。如何导入pdfplumber

EN

回答 1

Stack Overflow用户

发布于 2021-02-25 13:16:02

我猜这与我使用的Python版本有关。

在VS Code的右上角,它显示我的Python版本是Python 3

单击它并将其更改为Python 3.8.5,代码就可以工作了。这是在我重新启动VS Code和我的笔记本电脑并创建新路径之后完成的。

在以下资源后面的环境变量中创建新路径:

1. 'pip' is not recognized as an internal or external command

2. 2020 How to Fix "No Module Named..." Error in Python | Python Tutorial

3. Python Virtual Environments: A Primer

4. '' is not recognized as an internal or external command, operable program or batch file

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66361689

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档