【如何成功安装 Python 软件包 weditor】


如何成功安装 Python 软件包 weditor

在进行软件开发或者使用 Python 进行编程时,经常会遇到需要安装第三方软件包的情况。然而,有时候安装过程并不顺利,可能会遇到各种问题。在本文中,我将分享我解决安装 Python 软件包 weditor 的过程,并介绍了一个成功的解决方法。

背景

最近,我需要在我的 Python 环境中安装 weditor 这个软件包,用于编写 atx 脚本。然而,当我尝试使用常规的 pip install weditor 命令安装时,遇到了一些困难。

问题描述

在尝试使用 pip install weditor 命令安装 weditor 时,出现了如下错误:

[metadata]
name = weditor
author = codeskyblue
author_email = codeskyblue@gmail.com
summary = tool for writing atx script
license = MIT
home_page = https://github.com/openatx/weditor
description_file = README.md
classifier = 
    Environment :: Console
    Intended Audience :: Developers
    Operating System :: OS Independent
    Programming Language :: Python

[files]
packages = 
    weditor

[entry_points]
console_scripts = 
    weditor = weditor.__main__:main

[egg_info]
tag_build = 
tag_date = 0

解决方法

我采取了以下步骤来解决这个问题:

  1. 使用PyPI上发布的版本进行安装:首先,我尝试了从PyPI上安装 weditor 软件包,但是没有找到对应的发布版本。

  2. 使用Git仓库进行安装:随后,我决定尝试从 weditor 的 GitHub 仓库中直接克隆代码并安装。这种方式需要先安装 Git,并运行以下命令:

    git clone https://github.com/openatx/weditor.git
    cd weditor
    pip install .
    
  3. 手动下载和安装:最后,我手动下载了 weditor 的源代码包,并解压后进入目录,运行了 python setup.py install 命令进行安装。这种方法也很有效。

  4. 通过命令启动服务
    通过adb shell启动手机上的ATX服务。操作如下:

adb shell chmod 775 /data/local/tmp/atx-agent
adb shell /data/local/tmp/atx-agent server -d

5.画面不同步或者没画面解决办法
weditor同步不了手机画面解决方法如下:
1、首先确保adbdevices能查询到设备。
2、关键解决方法:删除手机上的ATX,重新执行python-muiautomator2init。
3、以防万一,不要直接执行weditor,一定要执行python-mweditor。
4、之后点击DumpHierarchy就可以同步画面了,不要用实时,直接用静态即可。

python -m uiautomator2 init
adb connect 127.0.0.1:5555
adb -s 127.0.0.1:5555 root
adb -s 127.0.0.1:5555 shell chmod 775 /data/local/tmp/atx-agent
adb -s 127.0.0.1:5555 shell /data/local/tmp/atx-agent server -d
timeout /nobreak /t 1
python -m weditor
pause

结论

通过尝试以上方法,我最终成功地安装了 weditor 软件包,并且可以顺利地在我的 Python 环境中使用了。这个经历让我学到了解决问题的耐心和方法,也希望本文的分享能够帮助到遇到类似问题的其他开发者。


  • 7
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值