0A_Windows下相同的时候设置Python2和Python3
分类:计算机编程

Gerapy是贰个Scrapy布满式管理模块,本节就来介绍一下它的设置方式。


Last login: Tue May 16 21:05:34 on console
➜  ~ brew update
zsh: command not found: brew
➜  ~ ruby -e "$(curl --insecure -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following existing directories will be made group writable:
/usr/local/bin
/usr/local/etc
/usr/local/lib
/usr/local/sbin
/usr/local/share
/usr/local/share/doc
/usr/local/share/man
/usr/local/share/man/man1
/usr/local/share/man/man8
==> The following existing directories will have their owner set to yysimac:
/usr/local/bin
/usr/local/etc
/usr/local/lib
/usr/local/sbin
/usr/local/share
/usr/local/share/doc
/usr/local/share/man
/usr/local/share/man/man1
/usr/local/share/man/man8
==> The following existing directories will have their group set to admin:
/usr/local/bin
/usr/local/etc
/usr/local/lib
/usr/local/sbin
/usr/local/share
/usr/local/share/doc
/usr/local/share/man
/usr/local/share/man/man1
/usr/local/share/man/man8
==> The following new directories will be created:
/usr/local/Cellar
/usr/local/Homebrew
/usr/local/Frameworks
/usr/local/opt
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod u rwx /usr/local/bin /usr/local/etc /usr/local/lib /usr/local/sbin /usr/local/share /usr/local/share/doc /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man8
Password:
==> /usr/bin/sudo /bin/chmod g rwx /usr/local/bin /usr/local/etc /usr/local/lib /usr/local/sbin /usr/local/share /usr/local/share/doc /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man8
==> /usr/bin/sudo /usr/sbin/chown yysimac /usr/local/bin /usr/local/etc /usr/local/lib /usr/local/sbin /usr/local/share /usr/local/share/doc /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man8
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/bin /usr/local/etc /usr/local/lib /usr/local/sbin /usr/local/share /usr/local/share/doc /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man8
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/chmod g rwx /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown yysimac /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/mkdir -p /Users/yysimac/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g rwx /Users/yysimac/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown yysimac /Users/yysimac/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/mkdir -p /Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g rwx /Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown yysimac /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 6010, done.
remote: Compressing objects: 100% (3708/3708), done.
remote: Total 6010 (delta 3392), reused 3974 (delta 2112), pack-reused 0
Receiving objects: 100% (6010/6010), 3.46 MiB | 49.00 KiB/s, done.
Resolving deltas: 100% (3392/3392), done.
From https://github.com/Homebrew/brew
 * [new branch]      master     -> origin/master
 * [new tag]         0.1        -> 0.1
 * [new tag]         0.2        -> 0.2
 * [new tag]         0.3        -> 0.3
 * [new tag]         0.4        -> 0.4
 * [new tag]         0.5        -> 0.5
 * [new tag]         0.6        -> 0.6
 * [new tag]         0.7        -> 0.7
 * [new tag]         0.7.1      -> 0.7.1
 * [new tag]         0.8        -> 0.8
 * [new tag]         0.8.1      -> 0.8.1
 * [new tag]         0.9        -> 0.9
 * [new tag]         0.9.1      -> 0.9.1
 * [new tag]         0.9.2      -> 0.9.2
 * [new tag]         0.9.3      -> 0.9.3
 * [new tag]         0.9.4      -> 0.9.4
 * [new tag]         0.9.5      -> 0.9.5
 * [new tag]         0.9.8      -> 0.9.8
 * [new tag]         0.9.9      -> 0.9.9
 * [new tag]         1.0.0      -> 1.0.0
 * [new tag]         1.0.1      -> 1.0.1
 * [new tag]         1.0.2      -> 1.0.2
 * [new tag]         1.0.3      -> 1.0.3
 * [new tag]         1.0.4      -> 1.0.4
 * [new tag]         1.0.5      -> 1.0.5
 * [new tag]         1.0.6      -> 1.0.6
 * [new tag]         1.0.7      -> 1.0.7
 * [new tag]         1.0.8      -> 1.0.8
 * [new tag]         1.0.9      -> 1.0.9
 * [new tag]         1.1.0      -> 1.1.0
 * [new tag]         1.1.1      -> 1.1.1
 * [new tag]         1.1.10     -> 1.1.10
 * [new tag]         1.1.11     -> 1.1.11
 * [new tag]         1.1.12     -> 1.1.12
 * [new tag]         1.1.13     -> 1.1.13
 * [new tag]         1.1.2      -> 1.1.2
 * [new tag]         1.1.3      -> 1.1.3
 * [new tag]         1.1.4      -> 1.1.4
 * [new tag]         1.1.5      -> 1.1.5
 * [new tag]         1.1.6      -> 1.1.6
 * [new tag]         1.1.7      -> 1.1.7
 * [new tag]         1.1.8      -> 1.1.8
 * [new tag]         1.1.9      -> 1.1.9
 * [new tag]         1.2.0      -> 1.2.0
 * [new tag]         1.2.1      -> 1.2.1
HEAD is now at 2b72638 info: fix conflicts formatting.
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 4409, done.
remote: Compressing objects: 100% (4215/4215), done.
remote: Total 4409 (delta 36), reused 450 (delta 14), pack-reused 0
Receiving objects: 100% (4409/4409), 3.50 MiB | 8.00 KiB/s, done.
Resolving deltas: 100% (36/36), done.
Tapped 4214 formulae (4,452 files, 10.9MB)
==> Cleaning up /Library/Caches/Homebrew...
==> Migrating /Library/Caches/Homebrew to /Users/yysimac/Library/Caches/Homebrew
==> Deleting /Library/Caches/Homebrew...
Already up-to-date.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate user behaviour analytics.
Read the analytics documentation (and how to opt-out) here:
  http://docs.brew.sh/Analytics.html

==> Next steps:
- Run `brew help` to get started
- Further documentation:
    http://docs.brew.sh
➜  ~

1.安装

第一步安装Python,在OS X日常已经暗中同意装了,python --version

第二步安装pip, sudo easy_install pip

其三部安装robotframework,试行pip install robotframework

设置进度中冒出谬误:

error: could not create '/Library/Python/2.7/site-packages/robot': Permission denied

注脚python目录没权力设置packages的包,化解:sudo chown -途锐 $USE讴歌ZDX/Library/Python/2.7
查看版本 :
robot --version
rebot --version
第四步 rf官方编辑器--卡宴IDE安装
pip install robotframework-ride
brew install wxPython
设置完后进行 ride.py
尽管能够展开ride,那么恭喜你安装成功。
若提示 wxPython not found.
wxPython 2.8.12.1 can be downloaded from 下载http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/
设置流程:http://www.voidcn.com/blog/xubeiqiannian/article/p-5994792.html

在上文安装robotframework后,目录里有二个demo文件(Libsite-packagesrobotframework-3.0.dist-infoDESCPAJEROIPTION.rst卡塔尔国,此时大家能够透过ride展开此文件,假诺张开的时候报“……is not a valid 罗布ot Framework test case or resourcefile”错误:

安装python库 :pip install docutils

5常用测量试验库安装
pip install requests
pip install robotframework-requests

1. 相关链接

  • GitHub:

时间:2018-01-09 00:31 作者:魏文应
python安装

截图:

2:创制测试用例

参照http://www.cnblogs.com/fnng/p/3871712.html
先是步:新建测量检验项目

图片 1

测验项目2.png

其次步:创制测量试验套件

图片 2

测验套件.png

其三步:创立测验用例

图片 3

测量试验用例2.png

第四步:导入selenium2library库,灰黄是表示库selenium2library没导入

图片 4

累积测量试验库.png

第五步:编写用例
行使谷歌浏览器案例

图片 5

测试chrome.png

图片 6

Google浏览器成功测验图.png

使用safari案例

图片 7

水到渠成测验图片.png

图片 8

建功立业打开浏览器图片.png

2. pip安装

那边推荐使用pip安装,命令如下:

pip3 install gerapy

图片 9

3: 使用主要字 -分层思想

参考:http://www.cnblogs.com/fnng/p/3969978.html
运用景况:当测量检验用例都走同一个剧本时,只是须求知道顾客输入的,和得出的结果
首先步:在测量试验项目中创建财富
其次步:在能源下开创首要字
其三步:编辑关键字,编辑argument
第四步:增多创设的财富到测验套件中
第五步:在测量检验用例中调用关键字

3. 测量试验安装

安装完结后,能够在Python命令行下测验:

$ python3
>>> import gerapy

大器晚成旦未有不当报出,则评释库已经安装好了。

大器晚成、安装情况

  • 操作系统: win7 六拾肆位(win7之上的windows版本卡塔尔
  • python2 版本: python2.7.14
  • python3 版本: python3.6.4

下载并安装homebrew

4:测试app

率先步:安装蒙受:http://blog.csdn.net/xyh421/article/details/52119872
sudo brew install node #安装nodejs
npm install -g appium #安装appium
appium #启动appium
安装appium,能够命令行
能够直接去官方网址下http://appium.io/getting-started.html?lang=zh
能够装Appium Doctor检查评定appium是不是安插成功:
npm install -g appium-doctor
设置需求的 Library:appiumlibrary,archivelibrary,SSHLibrary。
步入 Python 的安装路线,分别实施以下命令:
pip install robotframework-selenium2library
pip install robotframework-archivelibrary
pip install robotframework-SSHLibrary

设置和配置appium :https://bitbucket.org/appium/appium.app/downloads/
测量检验是不是产生布署,
appium使用参照:http://www.itdadao.com/articles/c15a572936p0.html

图片 10

Appium.png

并发难题:

图片 11

自己商量难题.png

解决:http://stackoverflow.com/questions/40129794/how-to-fix-error-could-not-detect-mac-os-x-version-from-sw-vers-output-10-12

图片 12

解决: http://appium.io/slate/en/master/?ruby#new-desired-capabilities,
本子不对,Appium1.5.3不帮衬Xcode8.1,须求更新appium只怕转移Xcode7
下载安装appium1.6本子现身难点

图片 13

安装appium错误.png

调换天猫镜像: npm install -g cnpm --registry=https://registry.npm.taobao.org
再走cnpm install -g appium@1.6.3
参照:http://www.mamicode.com/info-detail-1728757.html

编纂测量检验用例:增添测验app项目。增多套件,加多能源库,绑定appiumlibrary库和能源库,设置能源库变量,开启appium。

  • 代码示例
![](https://upload-images.jianshu.io/upload_images/2381877-beab67dbeb445a83.png)

测试案例text.png

图片 14

能源套件.png

测量检验成功后将report对应的路线增添到浏览器就可以观望报告

图片 15

报告.png

二、下载

  • python 下载:进入python官网https://www.python.org/,然后进入download页面:

    图片 16

    python版本接纳页面

  • python3 选用点击链接: Latest Python 3 Release - Python 3.6.4

  • python2 接收点击链接: Latest Python 2 Release - Python 2.7.14

  • python3 下载(下载页面列表中的 Windows x86-64 executable installer卡塔尔:

    图片 17

    python3下载页面

  • python2 下载(下载页面列表中的Windows x86-64 MSI installer卡塔尔:

    图片 18

    python2下载页面

图片 19

安装进度中冒出难题

执行pip install robotframework-selenium2library,

图片 20

截图.png

解决:sudo pip install tweepy

执行pip install robotframework-appiumlibrary

图片 21

安装applium库出难题.png

解决:pip install setuptools_scm

三、python安装

只顾: 关于python.exe纠正为python2.exe和python3.exe,以此来分别python2和python3的点子,大家会在“给python.exe创设硬链接”部分,有更加好的解决方案。

  • #### 1、python3安装:

  • 以处理人身份运维安装包python-3.6.4.exe。

  • 假若我们没有必要改善安装路线,况兼也没有必要其余供给,那么勾选上Add Python 3.6 to PATH,直接Install Now安装,等待安装完毕之后,下边几步就无需了,直接跳到 “2、python3测试” 即可。

  • 小编想让具有客户接受python(而持续是如今客户卡塔 尔(英语:State of Qatar),所以本身用了customize installation情势定制安装(大家要把Add Python 3.6 to PATH勾选上,不然安装完还要手工业增加安装路线到系统景况变量卡塔尔国:

    图片 22

    设置选项

  • 点击customize installation 今后,获得上边页面,全部勾选上,点击Next(下一步卡塔尔国 :

    图片 23

    python3定制安装图2

  • 在此个页面准将Intall for all users勾选上,使得全体客商都得以选拔,点击Install(安装卡塔 尔(英语:State of Qatar):

    图片 24

    python3定制安装图3

  • 本身这里python3安装的路线为C:Program Files (x86)Python36-32,安装达成点击close(关闭卡塔 尔(英语:State of Qatar)就可以:

    图片 25

    Python3定制安装图4

  • #### 2、python3测试:

  • 测验是还是不是安装成功,展开windows的cmd命令行终端,直接输入一下下令:

    python
    
  • 开首了python3解释器,输入以下代码,并回车:

      print("hellow world!!!")
    
  • 水到渠成打字与印刷了hellow world!!!,表明安装成功了:

    图片 26

    python3中标运维

  • 输入上面代码退出Python解释器:

    exit()
    
  • 在意:要是您曾经安装了python2,大概会运转的是python2并不是python3,你须求步向python36-32目录内定运营python3:

    cd C:Program Files (x86)Python36-32
    python
    
  • 无可辩驳,我们是想直接键入Python3,进而运维python3,所以大家把安装目录(C:Program Files (x86)Python36-32)下的python.exe改为python3.exe即可:

    图片 27

    重命名Python3

    那样大家在cmd中央直属机关接键入python3,就足以一向运营python3了。注意:改良未来重启一下cmd,再键入python3测验。

  • #### 3、Python2 安装:

  • 双击安装python-2.7.13.msi, 点击Next(下一步卡塔 尔(阿拉伯语:قطر‎:

    图片 28

    python2安装图1

  • 这一步选择设置路线,这里大家运用暗许路线(C:Python27),点击Next(下一步):

    图片 29

    python2安装图2

  • 将python2增多到系统意况变量中,供给将Add python.exe to Path选项选为:entire feature will be installed on local hard drive,然后点击Next(下一步卡塔 尔(阿拉伯语:قطر‎:

    图片 30

    python2安装图3

  • 于今截止安装到位。

表明是不是安装成功

➜  ~ brew
Example usage:
  brew search [TEXT|/REGEX/]
  brew (info|home|options) [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]

Troubleshooting:
  brew config
  brew doctor
  brew install -vd FORMULA

Developers:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]
  http://docs.brew.sh/Formula-Cookbook.html

Further help:
  man brew
  brew help [COMMAND]
  brew home
➜  ~

图片 31

测量试验brew安装成功

拉长测验用例时现身难点:

图片 32

测量试验浏览器bug.png

鸡犬不留:必要设置chromedriver 施行brew install chromedriver

4、Python2测试:

  • 测量检验是或不是安装成功,张开windows的cmd命令行终端,间接输入一下限令:

    py -2
    
  • 伊始了python2解释器,输入以下代码,并回车:

    print "hellow world!!!"
    
  • 瓜熟蒂落打字与印刷了 hellow world!!!,表明安装成功了:

    图片 33

    python2测试图1

  • 同风流浪漫我们改正安装目录(C:Python27)下的python.exe,改为python2.exe:

    图片 34

    python2测试图2

    这般就足以在cmd直接键入python2,运营Python2呐。

用easy_install安装Python的pip工具

➜  ~ pip
zsh: command not found: pip
➜  ~ sudo easy_install pip
Password:
Searching for pip
Reading https://pypi.python.org/simple/pip/
Best match: pip 9.0.1
Downloading https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9
Processing pip-9.0.1.tar.gz
Writing /tmp/easy_install-C3WDxF/pip-9.0.1/setup.cfg
Running pip-9.0.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-C3WDxF/pip-9.0.1/egg-dist-tmp-yI1cWT
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
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'
warning: no previously-included files found matching 'pip/_vendor/Makefile'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files found matching 'dev-requirements.txt'
warning: no previously-included files found matching 'appveyor.yml'
no previously-included directories found matching '.github'
no previously-included directories found matching '.travis'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'contrib'
no previously-included directories found matching 'tasks'
no previously-included directories found matching 'tests'
creating /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg
Extracting pip-9.0.1-py2.7.egg to /Library/Python/2.7/site-packages
Adding pip 9.0.1 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
➜  ~

四、python的pip使用难点:

  • python能够经过pip这一个命令,来便于地下载程序中的重视包。
  • 承保pip所在目录在系统变量中(python3平常都在卡塔 尔(英语:State of Qatar),将上面包车型地铁丰盛到系统变量PATH中(其实自个儿是拉长到顾客PATH中,那要依附你的设置路线而定卡塔尔国:

    C:Python27
    C:Python27Scripts
    

    图片 35

    丰富到系统境遇变量中

测量检验pip安装是或不是成功

➜  ~ pip

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring
                              environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be
                              used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be
                              used up to 3 times (corresponding to WARNING,
                              ERROR, and CRITICAL logging levels).
  --log <path>                Path to a verbose appending log.
  --proxy <proxy>             Specify a proxy in the form
                              [user:passwd@]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should
                              attempt (default 5 times).
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists:
                              (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
  --trusted-host <hostname>   Mark this host as trusted, even though it does
                              not have valid or any HTTPS.
  --cert <path>               Path to alternate CA bundle.
  --client-cert <path>        Path to SSL client certificate, a single file
                              containing the private key and the certificate
                              in PEM format.
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine
                              whether a new version of pip is available for
                              download. Implied with --no-index.
➜  ~

图片 36

测量试验pip安装成功

1、相同的时候安装了Python2和Python3,pip报错:fatal error in launcher: unable to create process using

  • 因为自己刚刚改过了python2和python3的称谓,要是直白键入pip2恐怕pip3,后安装的那几个python版本会报如下错误:

    fatal error in launcher: unable to create process using‘’‘’

    图片 37

    pip指令报错

    为此,通过校勘python.exe来区分python2和python3的做法,会使内部叁个pip不可用,大家能够透过上边的方法补救:

    python2 -m pip install xxx
    python3 -m pip install xxx

    python2 -m pip 相当于 pip2python3 -m pip 相当于 pip3

homebrew安装Python3.6.1

➜  ~ brew install python3
Updating Homebrew...
==> Installing dependencies for python3: pkg-config, readline, sqlite, gdbm, openssl, xz
==> Installing python3 dependency: pkg-config
==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.29.2.sierra.bo
######################################################################## 100.0%
==> Pouring pkg-config-0.29.2.sierra.bottle.tar.gz
==> Using the sandbox

			

本文由pc28.am发布于计算机编程,转载请注明出处:0A_Windows下相同的时候设置Python2和Python3

上一篇:轻量级并发程序,使用Python中的greenlet包完毕产出 下一篇:没有了
猜你喜欢
热门排行
精彩图文