栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

vscode启动Python调试 找不到指定模块

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

vscode启动Python调试 找不到指定模块

vscode在启动python调试时,要导入numpy模块,而且非常确定numpy已经安装了,但还是提示找到numpy模块

Exception has occurred: importError


importANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.8 from "C:Usershaijun.zhang1Anaconda3python.exe"
  * The NumPy version is: "1.20.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: DLL load failed while importing _multiarray_umath: 找不到指定的模块。

按照网上说的方法,在setting.json中设置了Python的路径,
在launch.json中设置了env

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: 当前文件",
            "type": "python",
            "request": "launch",
            "stopOnEntry": false,
            "program": "${file}",
            "pythonPath": "${command:python.interpreterPath}",
            "cwd": "${workspaceRoot}",
            "env": {"PYTHONPATH":"${workspaceRoot}"},
            "envFile": "${workspaceRoot}/.env",
            "console": "integratedTerminal"
        }
    ]
}

但还是不行。
最终解决方法,启动Anaconda prompt,通过cd指令切换到vscode的目录下,输入code .来启动vscode,就可以正常调试了。

欢迎关注微信公众号:Quant_Times

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/283246.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号