已安装鼻子,但无法在命令行上使用 [英] Installed Nose but cannot use on command line

查看:139
本文介绍了已安装鼻子,但无法在命令行上使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用easy_install在带有Python2.7.9的Mac OSX 10.10.5上安装了Nose.安装似乎成功:

I installed Nose on a Mac OSX 10.10.5 with Python2.7.9 using easy_install. The installation appeared to be successful:

Collecting nose
  Downloading nose-1.3.7-py2-none-any.whl (154kB)
    100% |████████████████████████████████| 155kB 2.3MB/s 
Installing collected packages: nose
Successfully installed nose-1.3.7

但是现在,当我甚至在命令行上使用鼻子测试尝试基本的东西时,例如nosetests -hwhich nosetests,我都会得到:

But now, when I try even basic stuff with nosetests on the command line, like nosetests -h or which nosetests I just get:

bash: nosetests: command not found

我尝试卸载,使用pip重新安装,尝试使用sudo安装,然后像其他帖子所建议的那样,在带有测试脚本的目录中运行sudo nostests,但似乎无济于事.

I have tried uninstalling, reinstalling using pip, tried installing with sudo and then running sudo nostests in the directories with tests scripts as other posts have suggested, but nothing seems to work.

安装的最初目的是使用鼻子为我为这些简单的web.py应用程序编写的测试脚本运行一些基本测试.但是什么都行不通,只要继续获得command not found响应即可.

The original purpose for installing was to use nose to run some basic tests with tests scripts I had written for these simple web.py apps. But nothing works, just keep getting the command not found response.

奇怪的是,当我在Terminal中打开Python解释器并执行以下操作时:

What's strange is that, when I open up the Python interpreter in Terminal, and do something like:

import nose 
nose.main()

我得到了预期的结果:

.
----------------------------------------------------------------------
Ran 1 test in 0.135s

OK

很显然它已安装...对这到底发生了什么有什么建议吗?

So clearly it's installed....somewhere. Any suggestions for what the hell is going on here?

推荐答案

在像OS X这样的类似UNIX的系统上,脚本应该位于/usr/local/bin中.确保该目录位于您使用的外壳程序的PATH环境变量中.

On UNIX-like systems like OS X, the script should be in /usr/local/bin. Make sure that directory is in the PATH environment variable in the shell that you use.

如果没有,您也可以使用find找到它,例如:

If not, you can also locate it using find, e.g:

find / -type f -name 'nosetests*' -perm +111 -print -quit

这意味着;搜索名称以nosetests开头的文件,该文件已设置了执行许可权.打印路径名称并停止.

This means; search for a file whose name starts with nosetests, which has execute permissions set. Print the path name and stop.

这篇关于已安装鼻子,但无法在命令行上使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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