前提・実現したいこと
PyCharmでmatplotlibを動作させたい
(OSはMacOSです)
発生している問題・エラーメッセージ
`Traceback (most recent call last):
File "/Users/suzuki.t/PycharmProjects/untitled2/plot.py", line 2, in <module>
import matplotlib.pyplot as plt
File "/Users/suzuki.t/PycharmProjects/untitled2/venv/lib/python2.7/site-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/Users/suzuki.t/PycharmProjects/untitled2/venv/lib/python2.7/site-packages/matplotlib/backends/init.py", line 63, in pylab_setup
[backend_name], 0)
File "/Users/suzuki.t/PycharmProjects/untitled2/venv/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py", line 17, in <module>
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 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.
Process finished with exit code 1
該当のソースコード
Python
1# coding=utf-8 2import matplotlib.pyplot as plt 3import numpy as np 4 5if __name__ == '__main__': 6 # データ生成 7 x = np.linspace(0, 10, 100) 8 y = x + np.random.randn(100) 9 10 # プロット 11 plt.plot(x, y, label="test") 12 13 # 凡例の表示 14 plt.legend() 15 16 # プロット表示(設定の反映) 17 plt.show()
試したこと
backendをTkAggに変えましたが依然として同様のエラーが出ます。
https://qiita.com/typecprint/items/0d4bea1251ab3f816303
ターミナルから実行するとグラフ描写が立ち上がります。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2020/07/09 09:41