VSCode运行Python出现ImportError: Missing required dependencies ['numpy']

  • 问题描述

    如题,在VSCode中运行Python文件,以前是可以正常运行的一个文件,出现题中错误。

  • 解决方案

  • 步骤一:

    参考3.

    lauch.json中,修改“env”。

    "env": {"PYTHONPATH":"${workspaceRoot}"}
    

    这里就涉及到如何打开lauch.json这个问题。

    《如何打开VSCode的lauch.json文件》

  • 步骤二:

    如上设置后,出现新的问题:

    《The above line should NO LONGER be in your ~/.bashrc file! 》

    terminal的选择窗口中更改Shell。

    Select dedault shell --> Command Prompt

    如此,可以正常运行python文件

  • References

  1. New To Visual Studio Code, having problems with pandas/numpy
  2. Python extension doesn’t run code properly #3534
  3. VScode Python no module的解决方法
发布了857 篇原创文章 · 获赞 1291 · 访问量 92万+

猜你喜欢

转载自blog.csdn.net/The_Time_Runner/article/details/105302435