原以为没有这些包,在终端安装了好久,都是包已存在,这样的错误……
Requirement already satisfied: pytz>=2017.3 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from pandas) (2021.1)
没想到,竟是 python3.sublime-build 的 问题
mac-sublime默认运行python2版本,mac自带python2……
mac安装sublime流程
Traceback (most recent call last):
File "/Users/X/Desktop/P/test.py", line 3, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
[Finished in 72ms with exit code 1]
[cmd: ['/usr/bin/python3', '-u', '/Users/X/Desktop/Ptest.py']]
[dir: /Users/Xg/Desktop/P]
[path: /opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin]
可将python3.sublime-build中的代码改为:
{
"cmd": ["/usr/local/bin/python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
Ps:要注意添加上 /local。
如果之前已经建立过python3.sublime-build文件,可通过一下方式打开文件,重新编写:
python3.sublime-build在资源库/Application Support/Sublime Text 3/Packages/User
资源库在mac-finder中显示:点击访达右上角圆圈三点