ImportError: No module named openpyxl
ImportError: No module named openpyxl
我通过 pip3 安装了 openpyxl,但每当我尝试将其导入我的脚本时,我都会收到此错误:
"python -u "/Users/hectorv/zipcodes/zips.py"
hectorv@Hectors-MacBook-Air zipcodes % python -u "/Users/hectorv/zipcodes/zips.py"
Traceback (most recent call last):
File "/Users/hectorv/zipcodes/zips.py", line 1, in <module>
import openpyxl
ImportError: No module named openpyxl"
当我再次尝试安装时,我得到了这个:
hectorv@Hectors-MacBook-Air zipcodes % pip3 install openpyxl
Requirement already satisfied: openpyxl in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (3.0.9)
Requirement already satisfied: et-xmlfile in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from openpyxl) (1.1.0)
您正在使用 Code Runner
,对吗?
您可以避免使用 Code Runner
。在您 select 编辑了正确的 python 解释器之后,您可以单击 Run Python File
按钮,或右键单击并 select Run Python File In Terminal
命令。
如果您坚持使用Code Runner
,可以在settings.json文件中添加"code-runner.runInTerminal": true,
。这是因为如果你直接在OUTPUT
面板中运行Code Runner
,它会利用全局python
,忽略python解释器select由 Python 扩展编辑。
我通过 pip3 安装了 openpyxl,但每当我尝试将其导入我的脚本时,我都会收到此错误:
"python -u "/Users/hectorv/zipcodes/zips.py"
hectorv@Hectors-MacBook-Air zipcodes % python -u "/Users/hectorv/zipcodes/zips.py"
Traceback (most recent call last):
File "/Users/hectorv/zipcodes/zips.py", line 1, in <module>
import openpyxl
ImportError: No module named openpyxl"
当我再次尝试安装时,我得到了这个:
hectorv@Hectors-MacBook-Air zipcodes % pip3 install openpyxl
Requirement already satisfied: openpyxl in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (3.0.9)
Requirement already satisfied: et-xmlfile in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from openpyxl) (1.1.0)
您正在使用 Code Runner
,对吗?
您可以避免使用 Code Runner
。在您 select 编辑了正确的 python 解释器之后,您可以单击 Run Python File
按钮,或右键单击并 select Run Python File In Terminal
命令。
如果您坚持使用Code Runner
,可以在settings.json文件中添加"code-runner.runInTerminal": true,
。这是因为如果你直接在OUTPUT
面板中运行Code Runner
,它会利用全局python
,忽略python解释器select由 Python 扩展编辑。