当前位置: 首页 > 工具软件 > PiP-Tool > 使用案例 >

RHEL/Centos7.x/python-2.7 install IDLE-PIP-AndroidTestLib-uiautomator

慕弘深
2023-12-01

# Python Android test module Github URL  

https://github.com/xiaocong/uiautomator

 

####### uiautomatorviewer tool in Android SDK 

lake@localhost:~/Android/android-sdk-linux$ ./tools/bin/uiautomatorviewer

 

 

############ Python dev for uiautomatorviewer  / RHEL7-x86-64bit

lake@localhost:~$ cd ~/software_x86_x64/python2.7-tool-idle/


lake@localhost:~/software_x86_x64/python2.7-tool-idle$ ls -l  
-rw-r--r-- 1 lake sys  868828 Sep 26 02:43 python-tools-2.7.5-34.el7.x86_64.rpm
-rw-r--r-- 1 lake sys  260628 Sep 26 02:50 tix-8.4.3-12.el7.x86_64.rpm
-rw-r--r-- 1 lake sys  325972 Sep 26 02:43 tkinter-2.7.5-34.el7.x86_64.rpm

################################# install IDLE Python Dev IDE for RHEL7 
[root@localhost python2.7-tool]#  rpm -ivh  python-tools-2.7.5-34.el7.x86_64.rpm    tkinter-2.7.5-34.el7.x86_64.rpm         ./tix-8.4.3-12.el7.x86_64.rpm 
warning: ./tix-8.4.3-12.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:tix-1:8.4.3-12.el7               ################################# [ 33%]
   2:tkinter-2.7.5-34.el7             ################################# [ 67%]
   3:python-tools-2.7.5-34.el7        ################################# [100%]


#######################################  Download PIP/Python module management tools  

lake@localhost:~/software_x86_x64/python2.7-tool-idle$ wget https://pypi.python.org/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/pip-8.1.1.tar.gz 
--2018-09-26 02:58:30--  https://pypi.python.org/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/pip-8.1.1.tar.gz
Resolving pypi.python.org (pypi.python.org)... 151.101.72.223, 2a04:4e42:11::223
Connecting to pypi.python.org (pypi.python.org)|151.101.72.223|:443... connected.
HTTP request sent, awaiting response... 301 Redirect to Primary Domain
Location: https://pypi.org/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/pip-8.1.1.tar.gz [following]
--2018-09-26 02:58:30--  https://pypi.org/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/pip-8.1.1.tar.gz
Resolving pypi.org (pypi.org)... 151.101.192.223, 151.101.0.223, 151.101.64.223, ...
Connecting to pypi.org (pypi.org)|151.101.192.223|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://files.pythonhosted.org/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/pip-8.1.1.tar.gz [following]
--2018-09-26 02:58:30--  https://files.pythonhosted.org/packages/41/27/9a8d24e1b55bd8c85e4d022da2922cb206f183e2d18fee4e320c9547e751/pip-8.1.1.tar.gz
Resolving files.pythonhosted.org (files.pythonhosted.org)... 151.101.229.63, 2a04:4e42:1a::319
Connecting to files.pythonhosted.org (files.pythonhosted.org)|151.101.229.63|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1139175 (1.1M) [application/octet-stream]
Saving to: \u2018pip-8.1.1.tar.gz\u2019

100%[============================================================================================>] 1,139,175   2.60MB/s   in 0.4s   

2018-09-26 02:58:31 (2.60 MB/s) - \u2018pip-8.1.1.tar.gz\u2019 saved [1139175/1139175]

lake@localhost:~/software_x86_x64/python2.7-tool-idle$ ls
pip-8.1.1.tar.gz  python-tools-2.7.5-34.el7.x86_64.rpm  tix-8.4.3-12.el7.x86_64.rpm  tkinter-2.7.5-34.el7.x86_64.rpm


lake@localhost:~/software_x86_x64/python2.7-tool-idle$ ls -l 
total 2544
-rw-r--r-- 1 lake sys 1139175 Apr 23  2016 pip-8.1.1.tar.gz
-rw-r--r-- 1 lake sys  868828 Sep 26 02:43 python-tools-2.7.5-34.el7.x86_64.rpm
-rw-r--r-- 1 lake sys  260628 Sep 26 02:50 tix-8.4.3-12.el7.x86_64.rpm
-rw-r--r-- 1 lake sys  325972 Sep 26 02:43 tkinter-2.7.5-34.el7.x86_64.rpm
lake@localhost:~/software_x86_x64/python2.7-tool-idle$ tar zxf pip-8.1.1.tar.gz 
lake@localhost:~/software_x86_x64/python2.7-tool-idle$ ls
pip-8.1.1  pip-8.1.1.tar.gz  python-tools-2.7.5-34.el7.x86_64.rpm  tix-8.4.3-12.el7.x86_64.rpm  tkinter-2.7.5-34.el7.x86_64.rpm
lake@localhost:~/software_x86_x64/python2.7-tool-idle$ cd pip-8.1.1/
lake@localhost:~/software_x86_x64/python2.7-tool-idle/pip-8.1.1$ ls
AUTHORS.txt  CHANGES.txt  docs  LICENSE.txt  MANIFEST.in  pip  pip.egg-info  PKG-INFO  README.rst  setup.cfg  setup.py

###############  Install PIP/Python module management tools  
lake@localhost:~/software_x86_x64/python2.7-tool-idle/pip-8.1.1$ which   python 
/usr/bin/python
lake@localhost:~/software_x86_x64/python2.7-tool-idle/pip-8.1.1$ ls -l  /usr/bin/python 
lrwxrwxrwx. 1 root root 7 Jun 13  2017 /usr/bin/python -> python2

lake@localhost:~/software_x86_x64/python2.7-tool-idle/pip-8.1.1$ sudo  python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to pip.egg-info/requires.txt
writing pip.egg-info/PKG-INFO
writing top-level names to pip.egg-info/top_level.txt
writing dependency_links to pip.egg-info/dependency_links.txt
writing entry points to pip.egg-info/entry_points.txt
reading manifest file 'pip.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching '.landscape.yml' 
.......................
.............
copying build/lib/pip/exceptions.py -> build/bdist.linux-x86_64/egg/pip
copying build/lib/pip/cmdoptions.py -> build/bdist.linux-x86_64/egg/pip
byte-compiling build/bdist.linux-x86_64/egg/pip/pep425tags.py to pep425tags.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/status_codes.py to status_codes.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/baseparser.py to baseparser.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/compat/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/compat/ordereddict.py to ordereddict.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/compat/dictconfig.py to dictconfig.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/index.py to index.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/download.py to download.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/req/req_uninstall.py to req_uninstall.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/req/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/req/req_file.py to req_file.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/req/req_set.py to req_set.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/req/req_install.py to req_install.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/utils/setuptools_build.py to setuptools_build.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/utils/outdated.py to outdated.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/utils/filesystem.py to filesystem.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/utils/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/utils/logging.py to logging.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/utils/ui.py to ui.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/utils/encoding.py to encoding.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/utils/deprecation.py to deprecation.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/utils/appdirs.py to appdirs.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/utils/build.py to build.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/utils/hashes.py to hashes.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/operations/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/operations/freeze.py to freeze.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/basecommand.py to basecommand.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/vcs/git.py to git.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/vcs/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/vcs/subversion.py to subversion.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/vcs/bazaar.py to bazaar.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/vcs/mercurial.py to mercurial.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/__main__.py to __main__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/wheel.py to wheel.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/commands/uninstall.py to uninstall.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/commands/list.py to list.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/commands/help.py to help.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/commands/download.py to download.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/commands/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/commands/show.py to show.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/commands/install.py to install.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/commands/completion.py to completion.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/commands/wheel.py to wheel.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/commands/freeze.py to freeze.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/commands/hash.py to hash.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/commands/search.py to search.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/status_codes.py to status_codes.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/sessions.py to sessions.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/cookies.py to cookies.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/hooks.py to hooks.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/certs.py to certs.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/models.py to models.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/compat.py to compat.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/structures.py to structures.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/utils.py to utils.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/auth.py to auth.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/adapters.py to adapters.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/api.py to api.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/exceptions.py to exceptions.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/charsetprober.py to charsetprober.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/charsetgroupprober.py to charsetgroupprober.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/chardetect.py to chardetect.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/sbcharsetprober.py to sbcharsetprober.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/escsm.py to escsm.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/mbcssm.py to mbcssm.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/cp949prober.py to cp949prober.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/jisfreq.py to jisfreq.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/codingstatemachine.py to codingstatemachine.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/mbcharsetprober.py to mbcharsetprober.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/universaldetector.py to universaldetector.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/langcyrillicmodel.py to langcyrillicmodel.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pip/_vendor/requests/packages/chardet/eucjpprober.py to eucjpprober.pyc
.........................
.............
creating dist
creating 'dist/pip-8.1.1-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing pip-8.1.1-py2.7.egg
creating /usr/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg
Extracting pip-8.1.1-py2.7.egg to /usr/lib/python2.7/site-packages
Adding pip 8.1.1 to easy-install.pth file
Installing pip script to /usr/bin
Installing pip2.7 script to /usr/bin
Installing pip2 script to /usr/bin

Installed /usr/lib/python2.7/site-packages/pip-8.1.1-py2.7.egg
Processing dependencies for pip==8.1.1
Finished processing dependencies for pip==8.1.1


#################################  Install android sdk test Python lib through Pip 

lake@localhost:~/software_x86_x64/python2.7-tool-idle/pip-8.1.1$ sudo  pip  install  uiautomator
Collecting uiautomator
  Downloading https://files.pythonhosted.org/packages/09/b7/d562585617f3edee3b856d7028202a35d50263bc126a5859924edf0dd406/uiautomator-0.3.2.tar.gz (2.9MB)
    100% | 2.9MB 320kB/s 
Requirement already satisfied (use --upgrade to upgrade): urllib3>=1.7.1 in /usr/lib/python2.7/site-packages (from uiautomator)
Installing collected packages: uiautomator
  Running setup.py install for uiautomator ... done
Successfully installed uiautomator-0.3.2
You are using pip version 8.1.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

####################################################### Write a python test script to test Android GUI 

 

 

lake@localhost:~/Cloud/Python$ python
Python 2.7.5 (default, Oct 11 2015, 17:47:16) 
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from uiautomator import device
>>> from uiautomator import device as d
>>> d.info
{u'displayRotation': 0, u'displaySizeDpY': 811, u'displaySizeDpX': 1442, u'screenOn': True, u'displayWidth': 1920, u'productName': u'rk3399_firefly_box', u'currentPackageName': u'com.android.music', u'sdkInt': 25, u'displayHeight': 1016, u'naturalOrientation': True}
>>> d.screen.off()
>>> d.screen.on()
>>> 

 

#################################################Linux/Python/uiautomator  will automatically install apk/stub named uiautomator/1.0 and  com.github.uiautomator.test (Test on Android7.1.2)

 

 Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program Name
tcp        0      0 :::9008                 :::*                    LISTEN      10835/com.github.uia

 

 类似资料: