Visual studio 代码报告 docopt 导入错误,而 bash 终端没有问题

Visual studio code reports docopt import error while there are no problems in bash terminal

刚刚安装了扩展程序 ms-python.python Visual studio 代码报告关于我在 main.py

中的代码
Import "docopt" could not be resolved from source 
{
"resource": "/home/XXXXXXXXX/main.py",
"owner": "_generated_diagnostic_collection_name_#0",
"code": {
    "value": "reportMissingModuleSource",
    
"severity": 4,
"message": "Import \"docopt\" could not be resolved from source",
"source": "Pylance",

}

为什么我可以正常导入模块而 vscode 扩展 ms-python.python 不能?

如果我运行python

 Python 3.9.6 (default, Jul 30 2021, 16:35:19) 
 [GCC 7.5.0] :: Anaconda, Inc. on linux
 Type "help", "copyright", "credits" or "license" for more
 information.
 >>> import importlib
 >>> docopt_spec = importlib.find_loader("docopt")
 >>> found = docopt_spec is not None
 >>> found
 True

在 bash 终端中,您正在使用 Anaconda。确保你有 select 它作为 python 解释器或将 docopt 包安装到你正在使用的环境中。

状态栏始终显示当前解释器。

official docs