强制Nosetests使用Python 2.7而不是3.4 [英] Force Nosetests to Use Python 2.7 instead of 3.4

查看:177
本文介绍了强制Nosetests使用Python 2.7而不是3.4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在学习使用3.4版的Python.我最近开始学习Web.py,因此一直使用Python 2.7,因为Python 3.4不支持web.py.我为Python 3.4和2.7安装了鼻子1.3.4模块.我需要在一些使用Web.py模块以2.7编写的Python代码上运行tailtests命令.但是,当我键入鼻子测试命令时,它会自动使用Python 3.4,因此抛出错误,因为无法在我的Python代码中导入Web.py模块.有没有一种方法可以强制鼻子测试使用Python 2.7?运行OS X Yosemite的Macbook Pro.

I've been learning Python using version 3.4. I recently started learning Web.py so have been using Python 2.7 for that, since web.py not supported in Python 3.4. I have nose 1.3.4 module installed for both Python 3.4 and 2.7. I need to run the nosetests command on some Python code written in 2.7 that uses the Web.py module. However, when I type nosetests command it automatically uses Python 3.4, so is throwing an error as unable to import the Web.py module in my Python code. Is there a way to force nosetests to use Python 2.7? Macbook Pro running OS X Yosemite.

推荐答案

@dano在他的评论中建议

As @dano suggeted in his comment:

尝试python2.7 -m nose而不是运行nosetests.

这篇关于强制Nosetests使用Python 2.7而不是3.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆