Python & Wxpython |这个程序需要访问屏幕吗?

问题描述

目标:使用 ESPHome Flasher https://github.com/esphome/esphome-flasher

TLDR:启动 esphomeflasher 我收到此错误消息:

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.

Python 设置:https://opensource.com/article/19/5/python-3-default-mac

Mac 设置:全新 Catalina 安装。

步骤:

  1. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. brew install pyenv
  3. pyenv install 3.9.1
  4. pyenv global 3.9.1
  5. echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc
  6. pip install --upgrade pip

安装 esphomeflasher: https://github.com/esphome/esphome-flasher

步骤:

  1. pip3 install wxpython
  2. pip3 install esphomeflasher

问题:

启动 esphomeflasher 时出现以下错误

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.

我找到了这个,但不知道如何将它应用到我的案例中。

https://blurringexistence.net/wxpython-using-virtualenvwrapper-on-osx.html

我的 .zshrc 配置:

if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi
PATH=$(pyenv root)/shims:$PATH

# We want to regularly go to our virtual environment directory
echo 'export WORKON_HOME=~/.virtualenvs' >> .zshrc
# If in a given virtual environment,make a virtual environment directory
# If one does not already exist
echo 'mkdir -p $WORKON_HOME' >> .zshrc
# Activate the new virtual environment by calling this script
# Note that $USER will substitute for your current user
echo '. ~/.pyenv/versions/3.9.1/bin/virtualenvwrapper.sh' >> .bash_profile
export WORKON_HOME=~/.virtualenvs
mkdir -p $WORKON_HOME
export WORKON_HOME=~/.virtualenvs
mkdir -p $WORKON_HOME

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)