简体   繁体   English

VSCode,MacOS 上的 Anaconda。 未找到模块(例如 Pandas 和 Numpy)

[英]VSCode, Anaconda on MacOS. Module not found (Pandas and Numpy for eg.)

So I installed vscode and anaconda on macos.所以我在macos上安装了vscode和anaconda。 I'm not a very experienced programmer and I can't figure out what is wrong.我不是一个非常有经验的程序员,我不知道出了什么问题。 When I try to import numpy or pandas it says module not found.当我尝试导入 numpy 或 pandas 时,它说找不到模块。 Any help to get this working is appreciated?任何帮助使这项工作得到赞赏?

In VSCode you need to specify the interpreter you want to use to run your code.在 VSCode 中,您需要指定要用于运行代码的解释器。 To do so, either click the button next to "Python" in the bottom right of the UI or search (CMD shift P) "Python: select interpreter," then select the right interpreter / environment you want to use.为此,请单击 UI 右下角“Python”旁边的按钮或搜索(CMD shift P)“Python:选择解释器”,然后选择您要使用的正确解释器/环境。

  1. Make sure you have the python extension installed.确保已安装python 扩展
  2. Make sure that you have installed these two packages.确保您已安装这两个软件包。 You can use command pip list in the terminal to view, or directly use pip install numpy and pip install pandas to install the packages.可以在终端使用命令pip list查看,或者直接使用pip install numpypip install pandas安装包。
  3. If the second step doesn't work, choose the Python interpreter correctly in vscode:如果第二步不行,在vscode中正确选择Python解释器:

Use the Ctrl+Shift+P command, search for and select Python:Select Interpreter (Or click directly on the python version displayed in the lower right corner), and select the correct interpreter.使用Ctrl+Shift+P命令,搜索并选择Python:Select Interpreter (或者直接点击右下角显示的python版本),选择正确的解释器。

在此处输入图像描述

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

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