在MAC OS X上,py.test无法识别为命令 [英] on MAC OS X, py.test not recognized as a command

查看:865
本文介绍了在MAC OS X上,py.test无法识别为命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MAC OS X 10.10上;我安装了pytest 2.6.4;但是在终端中,如果我写py.test甚至py.test --version;我收到错误消息:

On MAC OS X 10.10; I installed pytest 2.6.4; however in Terminal If I write py.test or even py.test --version; I get the error:

-bash: py.test command not found

(a)我想念什么吗?我该怎么做才能使pytest工具变得可识别. 我搜寻了很多;但找不到除 http://teckla.idyll.org/以外的任何信息〜t/transfer/py.test.html

(a) Am I missing anything? What do I do to make the pytest tool recognizable. I searched alot; but couldn't find any info except http://teckla.idyll.org/~t/transfer/py.test.html

我检查了PyCharm偏好设置,但没有在其中列出py.test解释器.但是,pip Frozen显示pytest 2.6.4已安装.

I checked in the PyCharm preferences, I don't see py.test interpreter listed there. However, pip freeze displays pytest 2.6.4 installed.

(b)是否需要在MAC上设置PYTHONPATH?尽管我已经看到Windows上不需要进行设置.

(b) Is PYTHONPATH required to be set on MAC? Although I've seen setting it is not required on Windows.

感谢所有指针,以帮助我解决这个问题.

Appreciate any pointers to help me resolve this.

更新:我的bash_profile的内容:

Update: Contents of my bash_profile:

echo export PATH="HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH"
PATH="/Users/admin/Library/Python/2.7/lib/python/site-packages:$PATH"
PATH="/System/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH"
export PATH

推荐答案

终于成功了! 下载pytest之后,我运行了以下命令,它就像魔术一样工作.我想,以前,我错过了将"sudo"放在安装命令的前面:

Got it worked finally! After downloading pytest, I ran the following commands and it worked like magic. I think,earlier, I missed putting "sudo" infront of the install command:

$python setup.py build
$sudo python setup.py install

输出说:

..
Installing py.test script to /usr/local/bin
Installing py.test-2.7 script to /usr/local/bin
Installed /Library/Python/2.7/site-packages/pytest-2.6.4-py2.7.egg
..
Using /Users/admin/Library/Python/2.7/lib/python/site-packages
Finished processing dependencies for pytest==2.6.4

我的.bash_profile内容,jfyr:

My .bash_profile contents, jfyr:

PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/System/Library/Frameworks/Python.framework/Versions/2.7/bin"
export PATH

这篇关于在MAC OS X上,py.test无法识别为命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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