mac上 已安装了oh-my-zsh,pip安装python库无法用命令行使用
报错 zsh: command not found: tidevice
➜ ~ tidevice
zsh: command not found: tidevice
➜ ~ airtest
zsh: command not found: airtest
一开始以为是系统安装多个python环境变量不统一的问题,但查找了python的版本,只有python3
➜ ~ which python
python not found
➜ ~ which python3
/usr/bin/python3
最后根据pip install时候的报错,给 .zshrc添加对应的环境变量后解决
➜ ~ pip3 install tidevice
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: tidevice in ./Library/Python/3.9/lib/python/site-packages (0.9.12)
Requirement already satisfied: Pillow in ./Library/Python/3.9/lib/python/site-packages (from tidevice) (9.3.0)
解决方案:
1.打开 ~/.zshrc
open ~/.zshrc
2.在zshrc文件里添加一行
export PATH="$HOME/Library/Python/3.9/bin:$PATH"
3.保存文件,并执行
source ~/.zshrc
4.命令行生效
➜ ~ tidevice
usage: tidevice [-h] [-v] [-u UDID] [--socket SOCKET] [--trace]
{version,list,info,date,sysinfo,appinfo,applist,battery,screenshot,install,uninstall,reboot,shutdown,parse,watch,wait-for-device,launch,energy,kill,ps,relay,xctest,wdaproxy,syslog,fsync,crashreport,dumpfps,developer,pair,unpair,perf,set-assistive-touch,savesslfile,test}