微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。