# Mac With Apple M1 安装 airtest 失败解决方案
项目需要,需要利用 airtest 进行一些Android 模拟器的脚本测试,所以需要 pip install airtest. (关键的其实是 pocoui ,最终追踪下来,安装这个模块时出错的。)
然后就理所当然的出错了:
```
pip install airtest
.......
Error: Failed building wheel for numpy
```
网上找了各种问题原因,归结如下:
1. python 版本过高导致,最好使用稳定的3.8
2. python 版本过高导致,最好使用稳定的3.6
3. wheel 有问题,重装 wheel
按照1 的方案,安装了 python 3.8。 在 mac 下切换版本(homebrew 安装的环境下):
```
arch -arm64 brew install python@3.8
brew unlink python@3.9 && brew link --overwrite python@3.8
```
此时,pip3 就是 ``` python3.8 -m pip ``` 了。
但,安装依然报同样的错。
然后参考方案2,准备安装 python3.6 / python 3.7 。 结果,系统不支持。
```
arch -arm64 pip3 install python@3.7
python@3.7: The x86_64 architecture is required for this software.
Error: python@3.7: An unsatisfied requirement failed this build.
```
game over . (由此可以看出,明显是版本问题导致无法正常 pip 安装模块,跟 wheel 也就没啥关系了)
## 峰回路转的'绿色版'解决方案
这下没办法了,所以思考了一下,装个 airtestIDE 先手工一下,然后脚本处理好了,再同步到服务器进行调试。
安装 airtestIDE 过程省略。
发现 airtestIDE 使用一切正常,那是不是他的依赖都是 OK 的、预编译好了的?python 能不能直接用他的模块呢?
于是,打开包内容 -> Contents -> MacOS ,发现真有关键的 poco 模块,于是,将其中关键的 poco 、 airtest、airtest_selenium 模块都直接复制到 python 的 site-packages 中。
再运行,补充一些需要的模块,大功告成!
```
get free device number: 3
deviceList: ['emulator-5554-0', 'emulator-5554-1', 'emulator-5554-2']
[pkg:]:getEmu cnt: 1 left_time:120
[pkg:]:error adb:0 out :List of devices attached
... ...
... ...
... ...
```
dr0v
blog.drov.com.cn一个人碎碎念。
A lazy security employee.
2021年9月23日星期四
2021年6月10日星期四
Posted by drovliu on 六月 10, 2021 with No comments
# Apple M1电脑装 Android 模拟器(AVD)
> 新版 mbp or mba 使用 M1芯片,暂时还不支持虚拟化,所以很多模拟器都不可用了,虽然 google 释出了android-emulator-m1-preview,但还存在很多 bug,麻烦。网上看到一个通过 Android Studio下载 arm64版本的 AVD 的可行方案,记录一下。
## 具体步骤
1. 更新你的 Android Studio 到最新版本。
2. Android Studio 右上角打开 Android Virtual Device Manager - 点选 Create Vitrual Device。
**重点在选择System Image的时候,选 Other Images 的标签。ABI 显示支持的芯片是 arm64-v8a。**

3. 下载完成,启动时会遇到:The emulator process for AVD was killed。
4. 打开Terminal,执行: ~/Library/Android/sdk/emulator/darwin-aarch64-replace.sh
```
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 651 100 651 0 0 649 0 0:00:01 0:00:01 --:--:-- 649
100 91.8M 100 91.8M 0 0 7862k 0 0:00:11 0:00:11 --:--:-- 10.9M
unzip emulator-darwin-aarch64-0.2.zip
Archive: emulator-darwin-aarch64-0.2.zip
creating: emulator-darwin-aarch64-0.2/
inflating: emulator-darwin-aarch64-0.2/NOTICE.csv
...
inflating: emulator-darwin-aarch64-0.2/lib/ui_controller_service.proto
inflating: emulator-darwin-aarch64-0.2/emulator
rm: ./lib64/qt/libexec/qtwebengine_resources.pak: No such file or directory
```
5. 此时,需要手动补充文件,Terminal 执行下方命令打开目录: open ~/Library/Android/sdk/emulator/
6. 将 emulator-darwin-aarch64-0.2 目录中的所有文件移动到上一级,覆盖。
7. 打开AVD面板,启动模拟器,即可正常使用。
## 参考
1. [3分钟搞定Apple M1电脑使用Android模拟器](https://zhuanlan.zhihu.com/p/372158270)
订阅:
博文 (Atom)
Search
Archive
Popular Posts
-
# hook原理 >在面微信的时候被开发的面试官问到了hook原理。我简单介绍了一般是替换函数地址的形式,保障先调用替换函数,再调用原始函数。 > >面试官的理解是有两种hook方式:一种是地址替换型,一种是代码插入型。 > >由此可知我对hook...
-
# 手机窃听 >华为面试时几个面试官反复提及手机窃听的技术手段问题。 > >我仅回答了画像圈定问题,没有涉及到潜在技术问题。 > >所以回来后检索了一下相关信息,才知道原来还有侧信道攻击的事。 常规认为的方式是,APP 申请了麦克风权限,后台静...