简体   繁体   English

Unable to Import & Import 无法解决

[英]Unable to Import & Import could not be resolved

i started programming today and i'm testing different code segments on Visual Studio Code.我今天开始编程,正在 Visual Studio Code 上测试不同的代码段。 However, when i tried importing a "numpy", 2 errors occured.但是,当我尝试导入“numpy”时,出现了 2 个错误。 I then proceeded to check other stack-overflow posts regarding this and I tried switching the Python Interpreter, however nothing changed.然后我继续检查与此相关的其他堆栈溢出帖子,并尝试切换 Python 解释器,但没有任何改变。 I also attempted doing other suggestions, however I don't understand how to do some of the suggestions (its my first time programming etc.)我也尝试做其他建议,但是我不明白如何做一些建议(这是我第一次编程等)

enter image description here在此处输入图像描述

Below is a zoomed up picture of it enter image description here下面是它的放大图片 在此处输入图片描述

I was wondering if I could get some help?我想知道我是否可以得到一些帮助?

Try opening the project folder in VsCode instead of opening the file by itself.尝试在 VsCode 中打开项目文件夹,而不是单独打开文件。 If that doesn't work, run the file through CMD, if running it through CMD doesn't work, you might not have the numpy library.如果这不起作用,请通过 CMD 运行该文件,如果通过 CMD 运行该文件不起作用,则您可能没有 numpy 库。 You can do that by going to CMD and write the following command:您可以转到 CMD 并编写以下命令:

pip install numpy pip 安装 numpy

Run跑步

pip show numpy

in integrated terminal, check if its location is <your selected interpreter>\lib\site-packages .在集成终端中,检查其位置是否为<your selected interpreter>\lib\site-packages

If is, reload window then the error should go away.如果是,重新加载 window那么错误应该 go 消失。

If not, please open an integrated Terminal and reinstall the module to current selected python environment.如果没有,请打开集成终端并将模块重新安装到当前选择的 python 环境。

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

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