0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【解決】This program needs access to the screen. Please run with a Framework build of python, and only when you are logged in on the main display of your Mac.

Posted at

環境

macOS Big Sur
python 3.7.5(pyenvの不具合でpyenv installではインストールできないやつ)

エラー文

This program needs access to the screen. Please run with a Framework build of python, and only when you are logged in on the main display of your Mac.

やろうとしてたこと

pyenvでインストールしたpythonで、wxpythonを動かそうとしてた。
一回諦めてtkinterに挑戦してみたけど、動かなかった。
wxpythonはtkinterをベースにしてるっぽいので、結局tkinterが動かなかったんだと思う

原因

wxpythonを使うのには、Framework buildのpythonがが必要になるらしい。
pyenv installで、入れたものはFramework build ではないので、上記エラーが出る。

さらにめんどくさいこと

pyenvとmacの相性が悪いのか、pyenvだと3系のpythonがうまく入らないので、下記のコマンドで入れてた。ややこし

CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.7.5 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)

エラー対応とframeworkbuildのpythonのインストール両方解決するコマンド

CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.7.5 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?