I'm trying to install nose on my computer for the Learn Python the Hard Way tutorial, but can't seem to get it to work. I'm using pip to install:
我试着在我的电脑上安装鼻子学习Python的艰苦的方法教程,但似乎不能使它工作。我正在使用pip安装:
$ pip install nose
And I get back:
我回到:
Requirement already satisfied (use --upgrade to upgrade): nose in /usr/local/lib/python2.7/site-packages
Cleaning up...
However, when I run the command nosetests, I get:
但是,当我运行命令nosetests时,我得到:
-bash: nosetests: command not found
I'm thinking there's something wrong with my PATH, but honestly I have no idea. Any help would be greatly appreciated!
我觉得我的路有点不对劲,但说实话我不知道。如有任何帮助,我们将不胜感激!
10 个解决方案
#1
9
I got this problem until I setup nose with sudo
:
我有这个问题,直到我用sudo设置鼻子:
sudo pip install nose
#2
8
i had the same problem but this solved it.
我也遇到过同样的问题,但这个问题解决了。
- Install: nose2
- 安装:nose2
- Then use: nose2 instead of nosetests to test program
- 然后使用:nose2而不是nosetests来测试程序
Good Luck...!
祝你好运!
#3
5
I'm using OS X 10.11.1.
我用的是OS X 10。11。1。
Do the following in the terminal:
在终端执行以下操作:
-
Move into directory
~/Python/2.7/site-packages/
进入目录~ / Python / 2.7 /网站/
-
type
sudo easy_install pip
键入sudo easy_install皮普
-
type
sudo easy_install virtualenv
键入sudo easy_install virtualenv
-
type
sudo easy_install nose
键入sudo easy_install鼻子
-
type
sudo easy_install distribute
键入sudo easy_install分发
-
Follow the steps as instructed in the Learn Python The Hard Way book.
按照在《学习Python》一书中指导的步骤进行学习。
#4
2
On OSX, using pip to install nose 1.3 installed nose to /usr/local/share/python/nosetests which isn't in the $PATH by default.
在OSX上,使用pip安装nose 1.3安装nose to /usr/local/share/python/nosetests,这在$PATH中是默认的。
#5
1
Sorry for resurrecting an old thread, but I just want to point out that no one has mentioned activating the virtual environment. People are asking "Are you in the virtual environment?" but user2778157 seems to be confused on exactly what that means. I would like to clarify this and think it may actually be the source of the problem. (Sorry for the pun on source).
很抱歉重新启用了一个旧线程,但是我只想指出,没有人提到激活虚拟环境。人们会问“你在虚拟环境中吗?”我想澄清这一点,我认为这可能是问题的根源。(不好意思源上的双关语)。
When you use pip install
, you aren't installing to your host's system, but into the virtual environment. When you create a virtual environment, it will have a folder bin
with a file activate
in it. In order to activate the virtual environment, you need to do source PATH/TO/ACTIVATE
. While your virtual environment is activated, your system will check your virtual environment for the program before checking the host, and this is where your pip packages should be.
当您使用pip安装时,您不是在主机的系统上安装,而是在虚拟环境中安装。当您创建一个虚拟环境时,它将有一个文件夹,其中包含一个激活的文件。为了激活虚拟环境,您需要执行源路径/ to / activate。当您的虚拟环境被激活时,您的系统将在检查主机之前检查您的虚拟环境,这就是您的pip包应该在的地方。
The reason you don't use sudo pip install
is because this will get the super user (who doesn't have the environment activated) to install the package, which will go to your host.
您不使用sudo pip安装的原因是,这将使超级用户(没有激活环境的用户)安装包,该包将进入您的主机。
#6
0
pigging backing off of 7stud, you could do sudo find / -name nosetests
and then append that to your PATH
从7stud上清除,您可以执行sudo查找/ -name nosetests,然后将其附加到路径中
(I'm sure that doing find
off of /
is a bit overkill, but I like that it goes over the entire OS)
(我敢肯定,这样做有点过头了,但我喜欢它胜过整个操作系统)
#7
0
However, when I run the command nosetests,
然而,当我运行命令nosetests时,
Of course, how you ran that command and from what directory might be important.
当然,您如何运行该命令以及从哪个目录中运行可能非常重要。
I'm thinking there's something wrong with my PATH, but honestly I have no idea.
我觉得我的路有点不对劲,但说实话我不知道。
If you do:
如果你做的事:
$ echo $PATH
...you will be able to see all the directories in your path. Of course, you can add any directory you want to your PATH.
…您将能够看到路径中的所有目录。当然,您可以向路径添加任何目录。
However, I recently installed nose on my mac, and I installed by hand:
然而,我最近在我的mac电脑上安装了nose,我是手工安装的:
.../Downloads$ tar xfvz nose-1.3.0
.../Downlaods$ cd nose-1.3.0
.../nose-1.3.0$ sudo python setup.py install
...and nosetests installed here:
…和nosetests安装:
$ which nosetests
/Library/Frameworks/Python.framework/Versions/2.7/bin/nosetests
And there is a nose directory in my site-packages directory as per usual, as well. So on my mac, nosetests installed in a directory outside the site-packages directory. It's possible that only newer versions of nose install the nosetests command. You might want to try:
和往常一样,在我的站点包目录中也有一个nose目录。所以在我的mac上,nosetests安装在站点包目录之外的目录中。可能只有新版本的nose安装nosetests命令。你可能想试试:
$ pip install --upgrade nose
#8
0
Setting PATH variable for 'nosetests' is required. Please use this one on your Terminal:
需要为“nosetests”设置路径变量。请在您的终端上使用这个:
alias nosetests='/Library/Frameworks/Python.framework/Versions/2.7/bin/nosetests'
别名nosetests = ' /图书馆/框架/ Python.framework /版本/ 2.7 / bin / nosetests '
Good luck!
好运!
#9
-1
I know this is an old thread but just in case someone else needs it:
我知道这是一条老掉牙的线索,但万一有人需要的话:
I'm using OS X 10.9.3. After installing all of the packages 'cd' into the project directory as instructed in the book. Then type
我用的是OS X 10。3。在按照书中的指示将所有软件包“cd”安装到项目目录之后。然后输入
sudo nosetests
Then you'll see what the 'learnpythonthehardway' author shows in the book and online.
然后你会看到“learnpythonthehardway”的作者在书中和网上都展示了什么。
#10
-1
You can reinstall using apt-get -y install python-nose
.
您可以重新安装使用apt-get -y安装python-nose。
#1
9
I got this problem until I setup nose with sudo
:
我有这个问题,直到我用sudo设置鼻子:
sudo pip install nose
#2
8
i had the same problem but this solved it.
我也遇到过同样的问题,但这个问题解决了。
- Install: nose2
- 安装:nose2
- Then use: nose2 instead of nosetests to test program
- 然后使用:nose2而不是nosetests来测试程序
Good Luck...!
祝你好运!
#3
5
I'm using OS X 10.11.1.
我用的是OS X 10。11。1。
Do the following in the terminal:
在终端执行以下操作:
-
Move into directory
~/Python/2.7/site-packages/
进入目录~ / Python / 2.7 /网站/
-
type
sudo easy_install pip
键入sudo easy_install皮普
-
type
sudo easy_install virtualenv
键入sudo easy_install virtualenv
-
type
sudo easy_install nose
键入sudo easy_install鼻子
-
type
sudo easy_install distribute
键入sudo easy_install分发
-
Follow the steps as instructed in the Learn Python The Hard Way book.
按照在《学习Python》一书中指导的步骤进行学习。
#4
2
On OSX, using pip to install nose 1.3 installed nose to /usr/local/share/python/nosetests which isn't in the $PATH by default.
在OSX上,使用pip安装nose 1.3安装nose to /usr/local/share/python/nosetests,这在$PATH中是默认的。
#5
1
Sorry for resurrecting an old thread, but I just want to point out that no one has mentioned activating the virtual environment. People are asking "Are you in the virtual environment?" but user2778157 seems to be confused on exactly what that means. I would like to clarify this and think it may actually be the source of the problem. (Sorry for the pun on source).
很抱歉重新启用了一个旧线程,但是我只想指出,没有人提到激活虚拟环境。人们会问“你在虚拟环境中吗?”我想澄清这一点,我认为这可能是问题的根源。(不好意思源上的双关语)。
When you use pip install
, you aren't installing to your host's system, but into the virtual environment. When you create a virtual environment, it will have a folder bin
with a file activate
in it. In order to activate the virtual environment, you need to do source PATH/TO/ACTIVATE
. While your virtual environment is activated, your system will check your virtual environment for the program before checking the host, and this is where your pip packages should be.
当您使用pip安装时,您不是在主机的系统上安装,而是在虚拟环境中安装。当您创建一个虚拟环境时,它将有一个文件夹,其中包含一个激活的文件。为了激活虚拟环境,您需要执行源路径/ to / activate。当您的虚拟环境被激活时,您的系统将在检查主机之前检查您的虚拟环境,这就是您的pip包应该在的地方。
The reason you don't use sudo pip install
is because this will get the super user (who doesn't have the environment activated) to install the package, which will go to your host.
您不使用sudo pip安装的原因是,这将使超级用户(没有激活环境的用户)安装包,该包将进入您的主机。
#6
0
pigging backing off of 7stud, you could do sudo find / -name nosetests
and then append that to your PATH
从7stud上清除,您可以执行sudo查找/ -name nosetests,然后将其附加到路径中
(I'm sure that doing find
off of /
is a bit overkill, but I like that it goes over the entire OS)
(我敢肯定,这样做有点过头了,但我喜欢它胜过整个操作系统)
#7
0
However, when I run the command nosetests,
然而,当我运行命令nosetests时,
Of course, how you ran that command and from what directory might be important.
当然,您如何运行该命令以及从哪个目录中运行可能非常重要。
I'm thinking there's something wrong with my PATH, but honestly I have no idea.
我觉得我的路有点不对劲,但说实话我不知道。
If you do:
如果你做的事:
$ echo $PATH
...you will be able to see all the directories in your path. Of course, you can add any directory you want to your PATH.
…您将能够看到路径中的所有目录。当然,您可以向路径添加任何目录。
However, I recently installed nose on my mac, and I installed by hand:
然而,我最近在我的mac电脑上安装了nose,我是手工安装的:
.../Downloads$ tar xfvz nose-1.3.0
.../Downlaods$ cd nose-1.3.0
.../nose-1.3.0$ sudo python setup.py install
...and nosetests installed here:
…和nosetests安装:
$ which nosetests
/Library/Frameworks/Python.framework/Versions/2.7/bin/nosetests
And there is a nose directory in my site-packages directory as per usual, as well. So on my mac, nosetests installed in a directory outside the site-packages directory. It's possible that only newer versions of nose install the nosetests command. You might want to try:
和往常一样,在我的站点包目录中也有一个nose目录。所以在我的mac上,nosetests安装在站点包目录之外的目录中。可能只有新版本的nose安装nosetests命令。你可能想试试:
$ pip install --upgrade nose
#8
0
Setting PATH variable for 'nosetests' is required. Please use this one on your Terminal:
需要为“nosetests”设置路径变量。请在您的终端上使用这个:
alias nosetests='/Library/Frameworks/Python.framework/Versions/2.7/bin/nosetests'
别名nosetests = ' /图书馆/框架/ Python.framework /版本/ 2.7 / bin / nosetests '
Good luck!
好运!
#9
-1
I know this is an old thread but just in case someone else needs it:
我知道这是一条老掉牙的线索,但万一有人需要的话:
I'm using OS X 10.9.3. After installing all of the packages 'cd' into the project directory as instructed in the book. Then type
我用的是OS X 10。3。在按照书中的指示将所有软件包“cd”安装到项目目录之后。然后输入
sudo nosetests
Then you'll see what the 'learnpythonthehardway' author shows in the book and online.
然后你会看到“learnpythonthehardway”的作者在书中和网上都展示了什么。
#10
-1
You can reinstall using apt-get -y install python-nose
.
您可以重新安装使用apt-get -y安装python-nose。