Mac運行Tensorflow的matplotlib問題

在mac上裝一個tensorflow做一些小的實驗還是蠻方便的。用virtualenv的方式避免了很多麻煩。
sudo pip install --upgrade virtualenv
virtualenv --system-site-packages tensorflow
pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.7.1-py2-none-any.whl

但是在運行的時候發現報錯:

from matplotlib.backends import _macosx
RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are Working with Matplotlib in a virtual enviroment see ‘Working with Matplotlib in Virtual environments’ in the Matplotlib FAQ

解決的方法也很簡單:
vim ~/.matplotlib/matplotlibrc
然後輸入以下內容:
backend: TkAgg

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章