简体   繁体   English

我无法在 Visual Studio 代码中导入 openpyxl

[英]I can't import openpyxl in visual studio code

I used the command pip3 install openpyxl , but I'm still getting the error, unresolved import 'openpyxl' .我使用了命令pip3 install openpyxl ,但我仍然收到错误, unresolved import 'openpyxl'

How I can import the library or fix this error?如何导入库或修复此错误?

  1. Enter the currently selected environment in the terminal: ( shortcut keys: Ctrl+Shift+` )I use a virtual environment.在终端输入当前选中的环境:(快捷键:Ctrl+Shift+`)我用的是虚拟环境。

    在此处输入图片说明

  2. Install the module " openpyxl " in your currently selected VScode environment:在您当前选择的 VScode 环境中安装模块“ openpyxl ”:

    在此处输入图片说明

  3. Reopen this file or reload VSCode after installation:安装后重新打开此文件或重新加载 VSCode:

    在此处输入图片说明

Check the installation:检查安装:

We can see the installation package of the module " openpyxl " under " .venv " of the virtual environment used.我们可以看到模块“的安装包openpyxl下”,“ .venv使用的虚拟环境”。

在此处输入图片说明

只需打开终端(如 vscode)并输入pip install openpyxl

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

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