首页 > 解决方案 > mac上的VS代码找不到pandas模块

问题描述

我在 Mac 上使用 VS 代码来完成我的 Python 作业。我安装了 pandas、numpy 和其他一些库,但只导入 pandas 会出现以下错误:

File "/Users/Li/Documents/Resources/lynda/recsys/RecSys-Materials/test.py", line 1, in <module>

import pandas as pd

ImportError: No module named pandas

导入错误

我仔细检查了我安装的熊猫:

pip install pandas

Requirement already satisfied: pandas in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.25.1)

Requirement already satisfied: python-dateutil>=2.6.1 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (2.7.4)

Requirement already satisfied: numpy>=1.13.3 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (1.17.1)

Requirement already satisfied: pytz>=2017.2 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (2018.9)

Requirement already satisfied: six>=1.5 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from python-dateutil>=2.6.1->pandas) (1.11.0)

和麻木:

pip install numpy

Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (1.17.1)

VS Code setting: python select interpreter: current: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3

我想知道我做错了哪一部分。任何帮助,将不胜感激!

标签: python-3.xmacosvisual-studio-codevscode-settings

解决方案


错误可能是由于无法从路径中检测到库引起的。


推荐阅读