macでidleを使う
Python3のインストール
python3 は homebrew でインストールした。
% brew install python3
% which python3
/opt/homebrew/bin/python3
% python3 --version
Python 3.11.3
この時点で idle を起動しようとすると…
% idle &
% ** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **
python-tk をインストールする
ネットの情報をみると、python-tk をインストールすればいいらしい。
% brew install python-tk
インストールはできたようだけど、最後にこんなメッセージが出た。
/opt/homebrew/Cellar/python-tk@3.11/3.11.3: 5 files, 149.8KB
==> Running brew cleanup python-tk@3.11
…
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see man bre
w).
brew cleanup python-tk@3.11 を実行しようとしたけど、
homebrew の設定によりできなかった…みたいな?
調べてみると、brew 2.0.0 から30日ごとに自動で brew cleanup が
走るようになっているみたい。
で、それを止めるために HOMEBREW_NO_INSTALL_CLEANUP という変数を
環境に登録しているようである。
じゃあ、かわりにやってあげてもいいのかな?
% brew cleanup python-tk@3.11
特に変化はないけど、まあ、無事に実行できたということでしょう。
% idle &
% ** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **
あれれ、起動しない。
ひょっとすると…
% which idle
/Applications/MAMP/Library/bin/idle
% which idle3
/opt/homebrew/bin/idle3
% idle3 & とすると、起動する。
MAMP の Python2 … 邪魔!
参考サイト
- 【Python】統合開発環境であるIDLEを使ってみよう!
- idleしたら、** IDLE can’t import Tkinter. Your Python may not be configured for Tk. **
- brew 2.0.0からcleanupが自動で走るようになっていた
カテゴリー: MacOS, memo, Python, Python3
タグ: idle, idle3, pyhon3
カウント: 222