当我想在 IDLE 中导入 matplotlib 时。出现以下错误:
ImportError: No module named matplotlib
我用的是 mac,我的 bash_profile 中 python 的 PATH 是:
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
几天前我试图从我的 mac 上卸载 python,所以我不确定我是否只是损坏了内置的 python。
我该如何解决这个问题?
最佳答案
您可以研究两件事。
- 路径的 Python 环境变量是 PYTHONPATH 而不仅仅是 PATH。改变它。
运行这条命令,看到路径确实包含了你需要的内容。
$ python -c 'import sys; print(sys.path)'
关于python - 导入错误 : No module named matplotlib in IDLE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35657421/