実現したいこと
- matplotlibのqtエラーを解消したい
前提
matplotlibを使おうとしてコードを書いたらエラーが起きました。去年の夏には問題なく動作していましたが、久しぶりに触ってみようと思ったらエラーが起きました。matplotlib.use('Agg')で試したところ写真は保存されましたのでコード自体は合っていると思います。
発生している問題・エラーメッセージ
qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
該当のソースコード
python
1import numpy as np 2import matplotlib.pyplot as plt 3 4x = np.linspace(0, 10, 500) 5y = np.sin(x) 6 7plt.figure() 8plt.plot(x, y) 9plt.show()
試したこと
https://support.borndigital.co.jp/hc/ja/articles/4406034081689-Qt%E3%81%8C%E5%8E%9F%E5%9B%A0%E3%81%A7%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E8%B5%B7%E5%8B%95%E3%81%AB%E5%A4%B1%E6%95%97%E3%81%99%E3%82%8B
環境変数へ探しに行きましたがpathがありませんでした。
https://qiita.com/dragonemox/items/2d17db7620979711d65c
QTインストール後、サイト内のpipコマンドを実行しましたがエラーが消えませんでした。
補足情報(FW/ツールのバージョンなど)
Python 3.10.9
python.org
Windows10
Name: matplotlib
Version: 3.6.1
Summary: Python plotting package
Home-page: https://matplotlib.org
Author: John D. Hunter, Michael Droettboom
License: PSF
Requires: contourpy, cycler, fonttools, kiwisolver, numpy, packaging, pillow, pyparsing, python-dateutil
Required-by: depthai-sdk, pycocotools
matplotlibはpipコマンドでインストール済み
