0
0

[忘備録] venvで作成したPython3.12仮想環境でtkinterが使えない場合の対処法

Posted at

解決方法

  • sudo apt-get install python3.12-tk
    • 使いたいPythonのバージョンに合わせたpython[version]-tk をインストール

環境

  • Ubuntu 22.04.4 LTS(WSL2)
  • python3.12
  • venv 3.12

症状

  • python3.12 -m venv env_name で仮想環境作成
  • 作成した仮想環境下でimport tkinter as tk すると以下のエラー
> python main.py
Traceback (most recent call last):
  File "~", line 1, in <module>
    import tkinter as tk
ModuleNotFoundError: No module named 'tkinter'

参考記事

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0