1、pip install pytest
2、pip easy_install pytest
3、pycharm 工具下安装失败。。。。。。。。。。。。。。。。。。。。。。。。。。。。、、
4、pip install -U pytest
我回过头自己看便宜charm 报的错,
Collecting pytest
Could not fetch URL https://pypi.python.org/simple/pytest/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:720) - skipping
Could not find a version that satisfies the requirement pytest (from versions: )
No matching distribution found for pytest
证书版本过期了,
出现这个错误的原因是python.org已经不支持TLSv1.0和TLSv1.1了。更新pip可以解决这个问题。但是如果使用传统的python -m pip install --upgrade pip的方式,还是会出现那个问题。这是一个鸡和蛋的问题,你因为TLS证书的问题需要去升级pip,升pip的时候又因为TLS证书的原因不能下载最新版本的pip。这时候就没有办法了,只能手动的去升级pip。
-
mac或者linux操作系统:在终端下执行命令:curl https://bootstrap.pypa.io/get-pip.py | python。 -
windows操作系统:从https://bootstrap.pypa.io/get-pip.py下载get-pip.py文件,然后使用python运行这个文件python get-pip.py即可。
这个方法我也试了无效。。。
总之。网上找的方法我都用了。
最后用了这个
pip install pytest -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
上面都是我走过的弯路,,,,希望你们不要走,