简体   繁体   English

初学者安装nosetests包

[英]beginner installing nosetests package

I'm trying to install the following as per the learnpythonthehardway tutorial: 我正在尝试根据learnpythonthehardway教程安装以下内容:

  1. pip from http://pypi.python.org/pypi/pip 请点击http://pypi.python.org/pypi/pip
  2. distribute from http://pypi.python.org/pypi/distribute http://pypi.python.org/pypi/distribute分发
  3. nose from http://pypi.python.org/pypi/nose/ 来自http://pypi.python.org/pypi/nose/的鼻子
  4. virtualenv from http://pypi.python.org/pypi/virtualenv 来自http://pypi.python.org/pypi/virtualenv的 virtualenv

I've visited these links and clicked the download button; 我访问了这些链接并点击了下载按钮; each file is in my downloads folder now, and I unarchive/unzipped them- not sure what this means but it seemed required. 现在每个文件都在我的下载文件夹中,我解压缩/解压缩它们 - 不确定这意味着什么,但它似乎是必需的。 Are they "installed"? 他们“安装”了吗? If not, what does it mean to really install them? 如果没有,真正安装它们意味着什么? I've tried typing nosetests in the terminal (as the book says you should), as well as tried easy_install but that doesn't seem to work. 我已经尝试在终端中输入nosetests (正如书中所说的那样),以及尝试easy_install但这似乎不起作用。 It appears my understanding is limited in a number of ways here. 看来我的理解在很多方面受到限制。

I get the following -bash: nosetests: command not found , but am trying to get: 我得到以下-bash: nosetests: command not found ,但我想得到:

nosetests . ---------------------------------------------------------------------- Ran 1 test in 0.007s OK

This works on mac, it may work on linux 这适用于mac,它可以在linux上运行

1)Open terminal (Be prepared to enter your password) 1)打开终端(准备输入密码)

2)Type: sudo easy_install pip 2)输入: sudo easy_install pip

3)Type: sudo pip install distribute 3)类型: sudo pip install distribute

4)Type: sudo pip install nose 4)类型: sudo pip install nose

5)Type: sudo pip install virtualenv 5)类型: sudo pip install virtualenv

Hope that helps, cheers! 希望有所帮助,欢呼!

They are not yet installed. 它们尚未安装。 Each has its own vagaries about how exactly the install process works and in fact some of those packages will include the other packages with them. 每个都有关于安装过程如何工作的变化,实际上其中一些包将包含其他包。 Ie

"If you use virtualenv, a copy of pip will be automatically be installed in each virtual environment you create." “如果你使用virtualenv,pip的副本将自动安装在你创建的每个虚拟环境中。”

http://pypi.python.org/pypi/pip http://pypi.python.org/pypi/pip

As a relatively new python user myself, (and having gone thru a similar process not long ago) I am eagerly awaiting the more complete answers that come back for this one. 作为一个相对较新的python用户我自己(并且不久前已经通过类似的过程)我热切期待着为这一个回来的更完整的答案。

Find out where the nosetests script is. 找出nosetests脚本的位置。 On OSX: 在OSX上:

/usr/local/share/nosetests

Execute directly, or set up a bash alias, perhaps in .bash_profile: 直接执行,或者设置bash别名,也许在.bash_profile中:

alias nosetests='/usr/local/share/python/nosetests'
alias nosetests3='/usr/local/share/python3/nosetests'

You were on the right track, but the package is actually called "nose". 你是在正确的轨道上,但包裹实际上被称为“鼻子”。 The documentation for nose (nosetests is the script) can be found here: https://nose.readthedocs.org/en/latest/ 可以在此处找到nose(nosetests是脚本)的文档: https//nose.readthedocs.org/en/latest/

The short answer is that you have 2 basic options: easy_install or pip . 简短的回答是你有两个基本选项: easy_installpip Install using setuptools/distribute: easy_install nose . 使用setuptools / distribute安装: easy_install nose Install using pip: pip install nose 使用pip install nosepip install nose

Install Python 2.7 and after just do this (only on Windows - Windows PowerShell): 安装Python 2.7,然后执行此操作(仅限Windows - Windows PowerShell):

  1. Setup PATH env: 设置路径环境:

C:\\Python27\\;C:\\Python27\\Scripts\\", "User" C:\\ Python27 \\; C:\\ Python27 \\ Scripts \\“,”User“

  1. pip is already installed pip已经安装好了

3. 3。

.\pip install distribute

4. 4。

.\pip install nose

5. 5。

.\pip install virtualenv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM