【python/matplotlib】pyplot.showでGUIが表示されない

環境

  • vagrant
  • centos 7
  • xming
  • python3.7

現象

matplotlib.pyplot.show()でグラフを表示しようとするが表示されず,以下のエラーがでる.

modulenotfounderror: no module named '_tkinter'

解決法

sudo yum install -y tk-devel

でtk-develをインストールし,Pythonを入れ直す.

curl -O https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
tar xf Python-3.7.3.tgz
cd Python-3.7.3
./configure
make
sudo make altinstall

コメント

タイトルとURLをコピーしました