python-3.x - 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 - 不确定 NumPy 数据类型的整数代表什么
- r - 在 R 中,x[with(x, order(x$CHROM)), ] 和 x[ order(x$CHROM)) , ] 有什么区别
- javascript - 在 HTML 中循环播放背景音乐
- junit5 - JUnit 5如何断言这个!= null
- c# - Unity中如何动态切换公有变量和私有变量
- colors - 电源应用程序 - 添加到附件图像中的媒体剪辑以更改背景颜色
- c# - c#绘制正方形以突出鼠标选择区域
- python - while 循环打印所有内容两次,Python --检查输入是否为整数 AND 在 (0-10) 范围内--
- windows - 在 Windows 上使用介子和 MSYS2 构建 GTK3 失败
- python-3.x - OpenCV-进程在 MAC 上以退出代码 139(被信号 11:SIGSEGV 中断)完成