在下面的示例中,python 版本为 2.7.6。
- 为什么是 2.7.6,而不是最新的 2.7.15?
- 如何指定 2.7.15?
设置
$ tox --version
2.7.0 imported from /home/obk/anaconda3/lib/python3.6/site-packages/tox/__init__.py
$ ls
tox.ini
$ cat tox.ini
[tox]
envlist = py27
skipsdist = True
[testenv]
commands = python -V
运行它:
$ tox -r
py27 recreate: /home/obk/repos/test/.tox/py27
py27 installed:
py27 runtests: PYTHONHASHSEED='4191112007'
py27 runtests: commands[0] | python -V
Python 2.7.6
___________________________________ summary ___________________________________________
py27: commands succeeded
congratulations :)
我想要最新的2.7.15的原因是因为我的项目有一个依赖项(my_foo
-> nbconvert
-> tornado
)现在正在使用 ssl.create_default_context
,即 added in 2.7.9 .
最佳答案
Why is it 2.7.6, and not the latest 2.7.15?
因为你电脑上Python 2.7的版本是2.7.6。
How do I specify 2.7.15?
在[testenv]
下指定basepython =/path/to/python2.7.15
,其中/path/to/python2.7.15
是版本 2.7.15 的本地副本的路径。
关于python - tox:如何指定python micro版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50882753/