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

问题描述 投票:0回答:1

我想导入

pdfplumber
并尝试过

import pdfplumber

并发现错误:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-b3d6737fd8e1> in <module>
----> 1 import pdfplumber

ModuleNotFoundError: No module named 'pdfplumber'

尝试使用

pip3 install pdfplumber
安装并返回:

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.

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

>>> pdfplumber
<module 'pdfplumber' from 'C:\\Python38\\lib\\site-packages\\pdfplumber\\__init__.py'>

但是

import pdfplumber
返回了同样的错误。如何导入
pdfplumber

python visual-studio-code import pdfplumber
1个回答
0
投票

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

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

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

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

1。 “pip”不被识别为内部或外部命令

2。 2020 如何修复 Python 中的“No Module Named...”错误Python教程

3. Python 虚拟环境:入门

4。 '' 不被识别为内部或外部命令、可运行程序或批处理文件

© www.soinside.com 2019 - 2024. All rights reserved.