TensorFlow MNIST机器学习 ImportError: Python is not installed as a framework
在跑TensorFlow的MNIST的机器学习的例子时候,demo来源:
https://github.com/GoogleCloudPlatform/tensorflow-without-a-phd/tree/master/tensorflow-mnist-tutorial
根据INSTALL.txt的步骤来安装,出现下面的错误:
MacBook-Pro:tensorflow-mnist-tutorial Vino$ python3 mnist_1.0_softmax.py
Traceback (most recent call last):
File “mnist_1.0_softmax.py”, line 17, in
import tensorflowvisu
File “/Users/Vino/PycharmProjects/tensorflow-without-a-phd/tensorflow-mnist-tutorial/tensorflowvisu.py”, line 18, in
import matplotlib.pyplot as plt
File “/anaconda3/lib/python3.7/site-packages/matplotlib/pyplot.py”, line 2372, in
switch_backend(rcParams[“backend”])
File “/anaconda3/lib/python3.7/site-packages/matplotlib/pyplot.py”, line 207, in switch_backend
backend_mod = importlib.import_module(backend_name)
File “/anaconda3/lib/python3.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “/anaconda3/lib/python3.7/site-packages/matplotlib/backends/backend_macosx.py”, line 14, in
from matplotlib.backends import _macosx
ImportError: 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 using (Ana)Conda please install python.app and replace the use of ‘python’ with ‘pythonw’. See ‘Working with Matplotlib on OSX’ in the Matplotlib FAQ for more information.
通过查找资料:
https://github.com/JuliaPy/PyCall.jl/issues/218
https://stackoverflow.com/questions/21784641/installation-issue-with-matplotlib-python
执行以下命令可以解决:
echo "backend: TkAgg" >> ~/.matplotlib/matplotlibrc
还没有评论,来说两句吧...