在Conda虚拟环境中运行matplotlib
遇到异常提示:python
彷佛是由于虚拟环境与默认环境的安装配置不一样形成的。shell
搜索错误信息以后,在STO上找到了解决方案:code
一、pip安装matplotlib以后,会在根目录下产生一个.matplotlib的目录:htm
➜ bin ll ~/.matplotlib total 280 -rw-r--r-- 1 me staff 78K 10 4 2015 fontList.cache -rw-r--r-- 1 me staff 59K 1 17 15:56 fontList.py3k.cache drwxr-xr-x 2 me staff 68B 10 4 2015 tex.cache
二、在这个目录下建立一个名为matplotlibrc的文件,内容是:blog
backend: TkAgg
而后保存退出,重启Python交互界面或从新运行脚本,import正常执行。ip
STO答案地址:http://stackoverflow.com/questions/21784641/installation-issue-with-matplotlib-pythonget