配置过程
pip3的安装看这篇文章MacOS python3的安装
运行pip3 install -U uiautomator2 安装uiautomator2
➜ ~ pip3 install -U uiautomator2
Collecting uiautomator2
Collecting whichcraft (from uiautomator2)
Using cached https://files.pythonhosted.org/packages/b5/a2/81887a0dae2e4d2adc70d9a3557fdda969f863ced51cd3c47b587d25bce5/whichcraft-0.6.1-py2.py3-none-any.whl
Collecting Pillow (from uiautomator2)
Using cached https://files.pythonhosted.org/packages/61/c1/efce2db357db76dc3a65e9a0982cd6501648685e64903fda590ed79b1ac8/Pillow-7.2.0-cp37-cp37m-macosx_10_10_x86_64.whl
Requirement already satisfied, skipping upgrade: six in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages (from uiautomator2) (1.12.0)
Collecting requests (from uiautomator2)
Using cached https://files.pythonhosted.org/packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl
Collecting retry~=0.9 (from uiautomator2)
Using cached https://files.pythonhosted.org/packages/4b/0d/53aea75710af4528a25ed6837d71d117602b01946b307a3912cb3cfcbcba/retry-0.9.2-py2.py3-none-any.whl
Collecting packaging~=20.3 (from uiautomator2)
Using cached https://files.pythonhosted.org/packages/46/19/c5ab91b1b05cfe63cccd5cfc971db9214c6dd6ced54e33c30d5af1d2bc43/packaging-20.4-py2.py3-none-any.whl
Collecting lxml>=4.3 (from uiautomator2)
Using cached https://files.pythonhosted.org/packages/87/34/460f1df365685ac91d9eba233c3b1f6980bb266048f770609fbec4691998/lxml-4.5.2-cp37-cp37m-macosx_10_9_x86_64.whl
Collecting Deprecated~=1.2.6 (from uiautomator2)
Using cached https://files.pythonhosted.org/packages/76/a1/05d7f62f956d77b23a640efc650f80ce24483aa2f85a09c03fb64f49e879/Deprecated-1.2.10-py2.py3-none-any.whl
Collecting logzero~=1.5 (from uiautomator2)
Using cached https://files.pythonhosted.org/packages/97/24/27295d318ea8976b12cf9cc51d82e7c7129220f6a3cc9e3443df3be8afdb/logzero-1.5.0-py2.py3-none-any.whl
Collecting cached-property<2.0,>=1.5.1 (from uiautomator2)
Using cached https://files.pythonhosted.org/packages/3b/86/85c1be2e8db9e13ef9a350aecd6dea292bd612fa288c2f40d035bb750ded/cached_property-1.5.1-py2.py3-none-any.whl
Collecting adbutils<1.0,>=0.8.2 (from uiautomator2)
Collecting progress~=1.3 (from uiautomator2)
Collecting chardet<4,>=3.0.2 (from requests->uiautomator2)
Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting idna<3,>=2.5 (from requests->uiautomator2)
Using cached https://files.pythonhosted.org/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests->uiautomator2)
Using cached https://files.pythonhosted.org/packages/9f/f0/a391d1463ebb1b233795cabfc0ef38d3db4442339de68f847026199e69d7/urllib3-1.25.10-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests->uiautomator2)
Using cached https://files.pythonhosted.org/packages/5e/c4/6c4fe722df5343c33226f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl
Collecting decorator>=3.4.2 (from retry~=0.9->uiautomator2)
Using cached https://files.pythonhosted.org/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl
Collecting py<2.0.0,>=1.4.26 (from retry~=0.9->uiautomator2)
Using cached https://files.pythonhosted.org/packages/68/0f/41a43535b52a81e4f29e420a151032d26f08b62206840c48d14b70e53376/py-1.9.0-py2.py3-none-any.whl
Collecting pyparsing>=2.0.2 (from packaging~=20.3->uiautomator2)
Using cached https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl
Collecting wrapt<2,>=1.10 (from Deprecated~=1.2.6->uiautomator2)
Collecting deprecation<3.0,>=2.0.6 (from adbutils<1.0,>=0.8.2->uiautomator2)
Using cached https://files.pythonhosted.org/packages/02/c3/253a89ee03fc9b9682f1541728eb66db7db22148cd94f89ab22528cd1e1b/deprecation-2.1.0-py2.py3-none-any.whl
Collecting apkutils2<2.0,>=1.0.0 (from adbutils<1.0,>=0.8.2->uiautomator2)
Collecting xmltodict (from apkutils2<2.0,>=1.0.0->adbutils<1.0,>=0.8.2->uiautomator2)
Using cached https://files.pythonhosted.org/packages/28/fd/30d5c1d3ac29ce229f6bdc40bbc20b28f716e8b363140c26eff19122d8a5/xmltodict-0.12.0-py2.py3-none-any.whl
Collecting cigam (from apkutils2<2.0,>=1.0.0->adbutils<1.0,>=0.8.2->uiautomator2)
Using cached https://files.pythonhosted.org/packages/3c/d0/19ff49c1938aea4e0076ee084ca23845408cffb51582b2be975f926533b5/cigam-0.0.3-py3-none-any.whl
Collecting pyelftools (from apkutils2<2.0,>=1.0.0->adbutils<1.0,>=0.8.2->uiautomator2)
Using cached https://files.pythonhosted.org/packages/bb/2f/bf41f3c3867d6707fa9b872658bb23088a64d0e522e8979f54c694b8cbe1/pyelftools-0.26-py2.py3-none-any.whl
Installing collected packages: whichcraft, Pillow, chardet, idna, urllib3, certifi, requests, decorator, py, retry, pyparsing, packaging, lxml, wrapt, Deprecated, logzero, cached-property, deprecation, xmltodict, cigam, pyelftools, apkutils2, adbutils, progress, uiautomator2
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/3.7/site-packages'
Consider using the `--user` option or check the permissions.
报错了,还是目录权限问题在python目录下创建3.7目录,修改拥有者,在python安装的文章中有介绍,然后再执行一遍就成功了。
然后我安装教程说明,执行python3 -m uiautomator2 init
➜ ~ python3 -m uiautomator2 init
/usr/local/bin/python3: No module named uiautomator2
我晕,提示说在/usr/local/bin/python3目录下没发现uiautomator2,可是我们刚才明明用pip3安装了uiautomator2,现在说找不到,那安装到哪里了呢?
➜ ~ pip3 freeze
adbutils==0.8.2
apkutils2==1.0.0
cached-property==1.5.1
certifi==2020.6.20
chardet==3.0.4
cigam==0.0.3
decorator==4.4.2
Deprecated==1.2.10
deprecation==2.1.0
idna==2.10
logzero==1.5.0
lxml==4.5.2
packaging==20.4
Pillow==7.2.0
progress==1.5
py==1.9.0
pyelftools==0.26
pyparsing==2.4.7
requests==2.24.0
retry==0.9.2
six==1.12.0
uiautomator2==2.11.3
urllib3==1.25.10
whichcraft==0.6.1
wrapt==1.12.1
xmltodict==0.12.0
➜ ~ pip3 show uiautomator2
Name: uiautomator2
Version: 2.11.3
Summary: Python Wrapper for Google Android UiAutomator2 test tool
Home-page: https://github.com/openatx/uiautomator2
Author: codeskyblue
Author-email: codeskyblue@gmail.com
License: MIT
Location: /Library/Python/3.7/site-packages
Requires: logzero, lxml, retry, cached-property, Pillow, adbutils, Deprecated, progress, requests, whichcraft, packaging, six
Required-by:
通过pip3 freeze命令,我发现确实安装了了uiautomator2了呀。
通过pip3 show uiautomator2命令,发现uiautomator2被安装到了/Library/Python/3.7/site-packages下。
奇怪,为啥会被安装到/Library/Python/3.7/site-packages下,而python3却在/usr/local/bin/python3目录下找呢?
研究发现python3和pip3是对应的,我电脑上之前配置过pip3,我也不知道为啥会有
➜ ~ which pip3
/usr/bin/pip3
➜ ~ pip3 -V
pip 19.0.3 from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7)
这个pip3是Xcode应用目录下的,明显不是我安装的python3目录下的。
我看网上教程说python3安装的时候,会自动安装pip3的,我没确定,就又安装了一遍pip3
➜ ~ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1841k 100 1841k 0 0 162k 0 0:00:11 0:00:11 --:--:-- 242k
➜ ~ python3 get-pip.py
Collecting pip
Using cached pip-20.2.3-py2.py3-none-any.whl (1.5 MB)
Collecting setuptools
Downloading setuptools-50.3.0-py3-none-any.whl (785 kB)
|████████████████████████████████| 785 kB 395 kB/s
Collecting wheel
Downloading wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Installing collected packages: pip, setuptools, wheel
WARNING: The scripts pip, pip3 and pip3.7 are installed in '/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The scripts easy_install and easy_install-3.7 are installed in '/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script wheel is installed in '/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.2.3 setuptools-50.3.0 wheel-0.35.1
我捣鼓了半天,不知道能让pip3和python3对应起来。既然有pip3是不是可能就已经有python3了呢?
所以,我先用brew把自己安装的python3给删了,看看还有没有python3
➜ ~ python3 -V
Python 3.7.3
➜ ~ which python3
/usr/bin/python3
➜ ~ cd /usr/bin
➜ bin ls -l python3
-rwxr-xr-x 1 root wheel 31488 4 7 03:52 python3
果然有一个python3,是在/usr/bin 目录下有个python3的可执行文件,不是软链接,是3.7.3版本,不知道是怎么安装上的。
上面已经看过pip3了,pip3 -V能看出来是来自Xcode。我估计python3也是来自Xcode,Xcode下确实有个python3,可是创建时间不一样呀!!!具体不知道什么情况,大小也不一样。
➜ ~ python3 -m uiautomator2 init
[I 200921 19:58:06 init:155] uiautomator2 version: 2.11.3
[I 200921 19:58:06 init:352] Install minicap, minitouch
[D 200921 19:58:06 init:62] Download https://tool.appetizer.io/openatx/stf-binaries/raw/0.2.2/node_modules/minitouch-prebuilt-beta/prebuilt/arm64-v8a/bin/minitouch
minitouch |⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿| 34.1 KB/34.1 KB
[D 200921 19:58:07 init:232] Push to /data/local/tmp/minitouch:0755
[D 200921 19:58:07 init:62] Download https://tool.appetizer.io/openatx/stf-binaries/raw/0.2.2/node_modules/minicap-prebuilt-beta/prebuilt/arm64-v8a/lib/android-24/minicap.so
minicap.so |⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿| 22.0 KB/22.0 KB
[D 200921 19:58:07 init:232] Push to /data/local/tmp/minicap.so:0755
[D 200921 19:58:07 init:62] Download https://tool.appetizer.io/openatx/stf-binaries/raw/0.2.2/node_modules/minicap-prebuilt-beta/prebuilt/arm64-v8a/bin/minicap
minicap |⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿| 526.5 KB/526.5 KB
[D 200921 19:58:07 init:232] Push to /data/local/tmp/minicap:0755
[D 200921 19:58:07 init:250] apk-debug package-info: None
[D 200921 19:58:07 init:251] apk-debug-test package-info: None
[I 200921 19:58:07 init:367] Install com.github.uiautomator, com.github.uiautomator.test 2.3.1
[D 200921 19:58:07 init:162] Shell: ('pm', 'uninstall', 'com.github.uiautomator')
[D 200921 19:58:08 init:162] Shell: ('pm', 'uninstall', 'com.github.uiautomator.test')
[D 200921 19:58:09 init:62] Download https://tool.appetizer.io/openatx/android-uiautomator-server/releases/download/2.3.1/app-uiautomator.apk
app-uiautomator.apk |⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿| 2.1 MB/2.1 MB
[D 200921 19:58:09 init:232] Push to /data/local/tmp/app-uiautomator.apk:0644
[D 200921 19:58:09 init:162] Shell: ('pm', 'install', '-r', '-t', '/data/local/tmp/app-uiautomator.apk')
[I 200921 19:58:12 init:332] - app-uiautomator.apk installed
[D 200921 19:58:12 init:62] Download https://tool.appetizer.io/openatx/android-uiautomator-server/releases/download/2.3.1/app-uiautomator-test.apk
app-uiautomator-test.apk |⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿| 1.2 MB/1.2 MB
[D 200921 19:58:12 init:232] Push to /data/local/tmp/app-uiautomator-test.apk:0644
[D 200921 19:58:12 init:162] Shell: ('pm', 'install', '-r', '-t', '/data/local/tmp/app-uiautomator-test.apk')
[I 200921 19:58:14 init:332] - app-uiautomator-test.apk installed
[I 200921 19:58:14 init:340] Install atx-agent 0.9.5
[D 200921 19:58:14 init:62] Download https://tool.appetizer.io/openatx/atx-agent/releases/download/0.9.5/atx-agent_0.9.5_linux_armv7.tar.gz
atx-agent_0.9.5_linux_armv7.tar.gz |⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿| 4.1 MB/4.1 MB
[D 200921 19:58:15 init:232] Push to /data/local/tmp/atx-agent:0755
[D 200921 19:58:15 init:162] Shell: ('/data/local/tmp/atx-agent', 'server', '--stop')
[D 200921 19:58:15 init:162] Shell: ('/data/local/tmp/atx-agent', 'server', '--nouia', '-d')
[D 200921 19:58:15 init:162] Shell: ('/data/local/tmp/atx-agent', 'server', '--nouia', '-d')
[I 200921 19:58:16 init:377] Check atx-agent version
[D 200921 19:58:16 init:390] Forward: local:tcp:50398 -> remote:tcp:7912
[D 200921 19:58:16 init:390] Forward: local:tcp:50398 -> remote:tcp:7912
[D 200921 19:58:17 init:393] atx-agent version 0.9.5
Successfully init AdbDevice(serial=7285df54)
成功了。结果折腾了半天,发现python3环境有,不用配置。
难道我们不能在MacOS上自己安装python3了?
不甘心!!通过brew再安装python3看看
重新安装一遍居然就可以了,而且自动在/usr/local/bin目录下自己建立了python3和pip3的软链接。说明,我们一开始brew安装python就没有安装好。
对于PATH搜索路径,usr/local/bin是优先于usr/bin的。
➜ ~ python3 -V
Python 3.7.5
➜ ~ which python3
/usr/local/bin/python3
➜ ~ cd /usr/local/bin
➜ bin git:(master) ✗ ls -l python3
lrwxr-xr-x 1 zhongyili admin 34 9 21 20:41 python3 -> ../Cellar/python/3.7.5/bin/python3
➜ bin git:(master) ✗ cd
➜ ~ pip3 -V
pip 19.3.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
➜ ~ which pip3
/usr/local/bin/pip3
➜ ~ cd /usr/local/bin
➜ bin git:(master) ✗ ls -l pip3
lrwxr-xr-x 1 zhongyili admin 31 9 21 20:41 pip3 -> ../Cellar/python/3.7.5/bin/pip3
➜ ~ echo $PATH
/usr/local/opt/ruby/bin:/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/bin/pip3:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/zhongyili/Library/Android/sdk/tools:/Users/zhongyili/Library/Android/sdk/platform-tools:/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin
pip
pip是对python的包管理工具,就像安装uiautomator2一样。那么pip把这些包安装到哪里了呢?
➜ ~ pip3 show uiautomator2
Name: uiautomator2
Version: 2.11.3
Summary: Python Wrapper for Google Android UiAutomator2 test tool
Home-page: https://github.com/openatx/uiautomator2
Author: codeskyblue
Author-email: codeskyblue@gmail.com
License: MIT
Location: /usr/local/lib/python3.7/site-packages
Requires: packaging, Deprecated, six, requests, progress, lxml, whichcraft, adbutils, cached-property, Pillow, logzero, retry
Required-by: weditor
我们发现是安装到/usr/local/lib/python3.7/site-packages目录下了,我们看看这个目录
➜ ~ cd /usr/local/lib/python3.7/site-packages
➜ site-packages git:(master) ✗ ls -la
total 1008
drwxr-xr-x 87 zhongyili admin 2784 9 22 17:07 .
drwxr-xr-x 3 zhongyili admin 96 9 21 20:41 ..
drwxr-xr-x 8 zhongyili admin 256 9 22 09:59 Deprecated-1.2.10.dist-info
drwxr-xr-x 103 zhongyili admin 3296 9 22 09:59 PIL
drwxr-xr-x 9 zhongyili admin 288 9 22 09:59 Pillow-7.2.0.dist-info
drwxr-xr-x 14 zhongyili admin 448 9 22 17:07 __pycache__
drwxr-xr-x 10 zhongyili admin 320 9 22 09:59 adbutils
drwxr-xr-x 10 zhongyili admin 320 9 22 09:59 adbutils-0.8.2.dist-info
drwxr-xr-x 12 zhongyili admin 384 9 22 09:59 apkutils2
drwxr-xr-x 7 zhongyili admin 224 9 22 09:59 apkutils2-1.0.0.dist-info
drwxr-xr-x 9 zhongyili admin 288 9 22 10:16 attrdict
drwxr-xr-x 9 zhongyili admin 288 9 22 10:16 attrdict-2.0.1.dist-info
drwxr-xr-x 9 zhongyili admin 288 9 22 09:59 cached_property-1.5.2.dist-info
-rw-r--r-- 1 zhongyili admin 4324 9 22 09:59 cached_property.py
drwxr-xr-x 7 zhongyili admin 224 9 22 09:59 certifi
drwxr-xr-x 8 zhongyili admin 256 9 22 09:59 certifi-2020.6.20.dist-info
drwxr-xr-x 43 zhongyili admin 1376 9 22 09:59 chardet
drwxr-xr-x 10 zhongyili admin 320 9 22 09:59 chardet-3.0.4.dist-info
drwxr-xr-x 5 zhongyili admin 160 9 22 09:59 cigam
drwxr-xr-x 9 zhongyili admin 288 9 22 09:59 cigam-0.0.3.dist-info
drwxr-xr-x 9 zhongyili admin 288 9 22 09:59 decorator-4.4.2.dist-info
-rw-r--r-- 1 zhongyili admin 17222 9 22 09:59 decorator.py
drwxr-xr-x 6 zhongyili admin 192 9 22 09:59 deprecated
drwxr-xr-x 8 zhongyili admin 256 9 22 09:59 deprecation-2.1.0.dist-info
-rw-r--r-- 1 zhongyili admin 12895 9 22 09:59 deprecation.py
-rw-r--r-- 1 zhongyili admin 126 10 29 2019 easy_install.py
drwxr-xr-x 8 zhongyili admin 256 9 22 09:59 elftools
drwxr-xr-x 10 zhongyili admin 320 9 22 10:16 facebook_wda-1.1.6.dist-info
drwxr-xr-x 18 zhongyili admin 576 9 22 17:07 flake8
drwxr-xr-x 9 zhongyili admin 288 9 22 17:07 flake8-3.8.3.dist-info
drwxr-xr-x 11 zhongyili admin 352 9 22 09:59 idna
drwxr-xr-x 8 zhongyili admin 256 9 22 09:59 idna-2.10.dist-info
drwxr-xr-x 7 zhongyili admin 224 9 22 17:07 importlib_metadata
drwxr-xr-x 8 zhongyili admin 256 9 22 17:07 importlib_metadata-1.7.0.dist-info
drwxr-xr-x 5 zhongyili admin 160 9 22 09:59 logzero
drwxr-xr-x 9 zhongyili admin 288 9 22 09:59 logzero-1.5.0.dist-info
drwxr-xr-x 24 zhongyili admin 768 9 22 09:59 lxml
drwxr-xr-x 9 zhongyili admin 288 9 22 09:59 lxml-4.5.2.dist-info
drwxr-xr-x 10 zhongyili admin 320 9 22 17:07 mccabe-0.6.1.dist-info
-rw-r--r-- 1 zhongyili admin 10693 9 22 17:06 mccabe.py
drwxr-xr-x 15 zhongyili admin 480 9 22 09:59 packaging
drwxr-xr-x 10 zhongyili admin 320 9 22 09:59 packaging-20.4.dist-info
drwxr-xr-x 7 zhongyili admin 224 9 21 21:05 pip
drwxr-xr-x 8 zhongyili admin 256 9 21 21:05 pip-19.3.1-py3.7.egg-info
drwxr-xr-x 7 zhongyili admin 224 9 21 21:05 pkg_resources
drwxr-xr-x 7 zhongyili admin 224 9 22 09:59 progress
drwxr-xr-x 8 zhongyili admin 256 9 22 09:59 progress-1.5.dist-info
drwxr-xr-x 24 zhongyili admin 768 9 22 09:59 py
drwxr-xr-x 8 zhongyili admin 256 9 22 09:59 py-1.9.0.dist-info
drwxr-xr-x 10 zhongyili admin 320 9 22 17:07 pycodestyle-2.6.0.dist-info
-rw-r--r-- 1 zhongyili admin 103376 9 22 17:07 pycodestyle.py
drwxr-xr-x 10 zhongyili admin 320 9 22 09:59 pyelftools-0.26.dist-info
drwxr-xr-x 11 zhongyili admin 352 9 22 17:07 pyflakes
drwxr-xr-x 9 zhongyili admin 288 9 22 17:07 pyflakes-2.2.0.dist-info
drwxr-xr-x 8 zhongyili admin 256 9 22 09:59 pyparsing-2.4.7.dist-info
-rw-r--r-- 1 zhongyili admin 273365 9 22 09:59 pyparsing.py
drwxr-xr-x 21 zhongyili admin 672 9 22 09:59 requests
drwxr-xr-x 10 zhongyili admin 320 9 22 09:59 requests-2.24.0.dist-info
drwxr-xr-x 7 zhongyili admin 224 9 22 09:59 retry
drwxr-xr-x 10 zhongyili admin 320 9 22 09:59 retry-0.9.2.dist-info
drwxr-xr-x 44 zhongyili admin 1408 9 21 21:05 setuptools
drwxr-xr-x 9 zhongyili admin 288 9 21 21:05 setuptools-41.6.0-py3.7.egg-info
-rw-r--r-- 1 zhongyili admin 2073 9 21 21:04 sitecustomize.py
drwxr-xr-x 8 zhongyili admin 256 9 22 09:59 six-1.15.0.dist-info
-rw-r--r-- 1 zhongyili admin 34159 9 22 09:59 six.py
drwxr-xr-x 38 zhongyili admin 1216 9 22 10:16 tornado
drwxr-xr-x 8 zhongyili admin 256 9 22 10:16 tornado-6.0.4.dist-info
drwxr-xr-x 23 zhongyili admin 736 9 22 09:59 uiautomator2
drwxr-xr-x 11 zhongyili admin 352 9 22 09:59 uiautomator2-2.11.3.dist-info
drwxr-xr-x 17 zhongyili admin 544 9 22 09:59 urllib3
drwxr-xr-x 8 zhongyili admin 256 9 22 09:59 urllib3-1.25.10.dist-info
drwxr-xr-x 10 zhongyili admin 320 9 22 10:16 wda
drwxr-xr-x 10 zhongyili admin 320 9 22 10:16 weditor
drwxr-xr-x 11 zhongyili admin 352 9 22 10:16 weditor-0.6.1.dist-info
drwxr-xr-x 12 zhongyili admin 384 9 21 21:05 wheel
drwxr-xr-x 9 zhongyili admin 288 9 21 21:05 wheel-0.33.6-py3.7.egg-info
drwxr-xr-x 9 zhongyili admin 288 9 22 09:59 whichcraft-0.6.1.dist-info
-rw-r--r-- 1 zhongyili admin 2881 9 22 09:59 whichcraft.py
drwxr-xr-x 8 zhongyili admin 256 9 22 09:59 wrapt
drwxr-xr-x 8 zhongyili admin 256 9 22 09:59 wrapt-1.12.1.dist-info
drwxr-xr-x 8 zhongyili admin 256 9 22 09:59 xmltodict-0.12.0.dist-info
-rw-r--r-- 1 zhongyili admin 17406 9 22 09:59 xmltodict.py
drwxr-xr-x 6 zhongyili admin 192 9 22 17:07 yapf
drwxr-xr-x 10 zhongyili admin 320 9 22 17:07 yapf-0.30.0.dist-info
drwxr-xr-x 28 zhongyili admin 896 9 22 17:07 yapftests
drwxr-xr-x 8 zhongyili admin 256 9 22 17:07 zipp-3.1.0.dist-info
-rw-r--r-- 1 zhongyili admin 7121 9 22 17:07 zipp.py
看到没?这里面有很多包。我理解,python包的概念其实就是一个个代码库,有些代码库是给我们做开发提供支持使用的,有些代码库在python环境下是可以运行的,即好像我们安装的uiautomator2库一样。
参考
brewhome和pip的区别
安装pip3(mac)
pip/pip3 包安装到哪儿了
Mac下终端pip与pip3配置(软链接)
Python环境构建