質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Tkinter

Tkinterは、GUIツールキットである“Tk”をPythonから利用できるようにした標準ライブラリである。

Q&A

解決済

2回答

12767閲覧

macのtkinterをバージョンアップしたい

P_Beginner

総合スコア99

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Tkinter

Tkinterは、GUIツールキットである“Tk”をPythonから利用できるようにした標準ライブラリである。

0グッド

0クリップ

投稿2020/01/06 10:53

前回にこちらでも質問しましたが,tkinterのボタン表示がおかしいです.

いろいろ調べてみると,tcl-tkのバージョン?を8.6にすると良さそうだとわかりました.

Macのtkinter8.5でpngをまともに表示できない→PyenvのPython再インストールでtcl-tkをバージョンアップした

そこで上の記事を参考に進めていったのですが,--with-tcl-tkをつけるとエラーが発生してしまいます.
これはどのように対処すれば良いのでしょうか?

$ brew install python3 --with-tcl-tk Usage: brew install [options] formula Install formula. Additional options specific to formula may be appended to the command. Unless HOMEBREW_NO_INSTALL_CLEANUP is set, brew cleanup will then be run for the installed formulae or, every 30 days, for all formulae. -d, --debug If brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory. --env If std is passed, use the standard build environment instead of superenv. If super is passed, use superenv even if the formula specifies the standard build environment. --ignore-dependencies An unsupported Homebrew development flag to skip installing any dependencies of any kind. If the dependencies are not already present, the formula will have issues. If you're not developing Homebrew, consider adjusting your PATH rather than using this flag. --only-dependencies Install the dependencies with specified options but do not install the formula itself. --cc Attempt to compile using the specified compiler, which should be the name of the compiler's executable, e.g. gcc-7 for GCC 7. In order to use LLVM's clang, specify llvm_clang. To use the Apple-provided clang, specify clang. This option will only accept compilers that are provided by Homebrew or bundled with macOS. Please do not file issues if you encounter errors while using this option. -s, --build-from-source Compile formula from source even if a bottle is provided. Dependencies will still be installed from bottles if they are available. --force-bottle Install from a bottle if it exists for the current or newest version of macOS, even if it would not normally be used for installation. --include-test Install testing dependencies required to run brew test formula. --devel If formula defines it, install the development version. --HEAD If formula defines it, install the HEAD version, aka. master, trunk, unstable. --fetch-HEAD Fetch the upstream repository to detect if the HEAD installation of the formula is outdated. Otherwise, the repository's HEAD will only be checked for updates when a new stable or development version has been released. --keep-tmp Retain the temporary files created during installation. --build-bottle Prepare the formula for eventual bottling during installation, skipping any post-install steps. --bottle-arch Optimise bottles for the specified architecture rather than the oldest architecture supported by the version of macOS the bottles are built on. -f, --force Install without checking for previously installed keg-only or non-migrated versions. -v, --verbose Print the verification and postinstall steps. --display-times Print install times for each formula at the end of the run. -i, --interactive Download and patch formula, then open a shell. This allows the user to run ./configure --help and otherwise determine how to turn the software package into a Homebrew package. -g, --git Create a Git repository, useful for creating patches to the software. -h, --help Show this message. Error: invalid option: --with-tcl-tk

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

自己解決

理由は不明だが,いつの間にかTkinterのバージョンが8.6になっていた.
そのため,本質問でエラー(と思っていた現象)は解消した.

投稿2020/02/02 11:31

P_Beginner

総合スコア99

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

単純に記事を誤読しているように見えます。記事中には下のコマンドが掲載されているのでこの通り打ってみてください。

$ brew info tcl-tk #バージョンが8.6以上か確認

tcl-tkのバージョンが8.6よりも低ければ次のコマンドでアップグレード出来ます。

$ brew upgrade tcl-tk

投稿2020/01/06 12:01

yuokada

総合スコア550

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

P_Beginner

2020/01/06 14:44

8.6より低いというか, $ python3 -m tkinter で8.5と表示されるので,とりあえず参考サイトに書いてあることをやっています. バージョン確認すると $ brew info tcl-tk tcl-tk: stable 8.6.9 (bottled) [keg-only] Tool Command Language https://www.tcl.tk/ /usr/local/Cellar/tcl-tk/8.6.9_1 (2,983 files, 50.1MB) Poured from bottle on 2020-01-06 at 19:42:09 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/tcl-tk.rb ==> Dependencies Required: openssl@1.1 ✔ ==> Caveats tcl-tk is keg-only, which means it was not symlinked into /usr/local, because tk installs some X11 headers and macOS provides an (older) Tcl/Tk. If you need to have tcl-tk first in your PATH run: echo 'export PATH="/usr/local/opt/tcl-tk/bin:$PATH"' >> ~/.bash_profile For compilers to find tcl-tk you may need to set: export LDFLAGS="-L/usr/local/opt/tcl-tk/lib" export CPPFLAGS="-I/usr/local/opt/tcl-tk/include" For pkg-config to find tcl-tk you may need to set: export PKG_CONFIG_PATH="/usr/local/opt/tcl-tk/lib/pkgconfig" ==> Analytics install: 4,936 (30 days), 15,421 (90 days), 50,935 (365 days) install-on-request: 3,009 (30 days), 10,231 (90 days), 36,413 (365 days) build-error: 0 (30 days) 8.6.9と書いてあるのでアップグレードはできたが反映できていないように自分は解釈しました. 反映させるために,質問のコマンドが必要なのかなと思ったのですが違うのでしょうか?
yuokada

2020/01/06 17:33

brew reinstall python3 をしてみたらどうでしょうか?
P_Beginner

2020/01/07 10:30

brew reinstall python3 はうまくいきましたが, その後に brew upgrade tcl-tk をやっても python -m tkinter で表示されたのは8.5でした. $ brew reinstall python3 ==> Reinstalling python ==> Downloading https://homebrew.bintray.com/bottles Already downloaded: /Users/USER/Library/Caches/Homebrew/downloads/d5d5e7ec237016a2c35d66ddbe2edfa461d9fa20da5cad2ad3ffeb08f6d87bae--python-3.7.6_1.catalina.bottle.tar.gz ==> Pouring python-3.7.6_1.catalina.bottle.tar.gz ==> /usr/local/Cellar/python/3.7.6_1/bin/python3 -s ==> /usr/local/Cellar/python/3.7.6_1/bin/python3 -s ==> /usr/local/Cellar/python/3.7.6_1/bin/python3 -s ==> Caveats Python has been installed as /usr/local/bin/python3 Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to `python3`, `python3-config`, `pip3` etc., respectively, have been installed into /usr/local/opt/python/libexec/bin If you need Homebrew's Python 2.7 run brew install python@2 You can install Python packages with pip3 install <package> They will install into the site-package directory /usr/local/lib/python3.7/site-packages See: https://docs.brew.sh/Homebrew-and-Python ==> Summary ???? /usr/local/Cellar/python/3.7.6_1: 3,977 files, 61MB $ brew upgrade tcl-tk Warning: tcl-tk 8.6.9_1 already installed $ python3 -m tkinter DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
yuokada

2020/01/07 13:57 編集

export PKG_CONFIG_PATH="/usr/local/opt/tcl-tk/lib/pkgconfig" 上の環境変数を設定してbrew reinstall python3をしたらどうでしょうか? filepathは次のコマンドで見つかります。 mdfind -name tcl.pc|grep /usr/local/Cellar
P_Beginner

2020/01/07 14:11

mdfind -name tcl.pc|grep /usr/local/Cellar の結果を export PKG_CONFIG_PATH="" のダブルクォートに入れるということでしょうか?
yuokada

2020/01/07 14:13

export PKG_CONFIG_PATH="/usr/local/opt/tcl-tk/lib/pkgconfig" mdfindを実行しなくても上のまま変数をセットしてもリンクされると主ます。
P_Beginner

2020/01/07 14:45

正常に実行されましたが,python3 -m tkinter では8.5のままでした.
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問