python 使用 easy_install 安装机械化

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2159733/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 23:56:10  来源:igfitidea点击:

installing mechanize with easy_install

pythonmechanizeeasy-install

提问by Diego

I just got easy_install downloaded but i'm having problems installing mechanize, should I be addressing site-packages at any point. In the first try below, i got an error. in the second try below, i got command not found which is wierd since I know for sure that it downloaded.

我刚刚下载了 easy_install,但我在安装 mechanize 时遇到了问题,我应该在任何时候处理站点包。在下面的第一次尝试中,我遇到了错误。在下面的第二次尝试中,我找不到命令,这很奇怪,因为我确定它已下载。

names-computer:~ names$ cd /Users/names/Desktop/
names-computer:~/Desktop names$ sh /Users/names/Desktop/mechanize-0.1.9-py2.5.egg
/Users/names/Desktop/mechanize-0.1.9-py2.5.egg: /Users/names/Desktop/mechanize-0.1.9-py2.5.egg: cannot execute binary file

names-computer:~/Desktop names$ easy_install mechanize
-bash: easy_install: command not found

采纳答案by Ned Deily

On OS X, Python interpreter instances are typically installed as so-called Framework builds which means that there is a bindirectory within the framework which is typically (but not always) the installation destination for python scripts, such as easy_install. If you are not using the Apple-supplied python (in /usr/bin/) which has its own easy_installinstance there, you should ensure that the framework bin directory of the desired python is on your shell search PATH and precedes /usr/bin. In particular, if you are using the python installed by the python.org installer, your PATH should look something like this:

在 OS X 上,Python 解释器实例通常作为所谓的框架构建安装,这意味着框架中有一个bin目录通常(但不总是)是 Python 脚本的安装目标,例如easy_install. 如果您没有使用 Apple 提供的 Python(在 /usr/bin/ 中),它easy_install在那里有自己的实例,您应该确保所需 Python 的框架 bin 目录在您的 shell 搜索 PATH 中并位于/usr/bin. 特别是,如果您使用的是由 python.org 安装程序安装的 python,则您的 PATH 应该如下所示:

$ echo $PATH
/Library/Frameworks/Python.framework/Versions/2.6/bin:/usr/bin:/bin

That ensures that the proper easy_installwill be found first. If you are using a MacPorts python, it should look like this:

这确保easy_install首先找到正确的。如果您使用的是 MacPorts python,它应该如下所示:

$ echo $PATH
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin:/opt/local/bin:/usr/bin:/bin

EDIT: By the way, the egg that you downloaded appears to be for Python 2.5 and judging from a previous question, you may be wanting to use it with python 2.6. If you just use the command

编辑:顺便说一下,您下载的蛋似乎适用于 Python 2.5,从上一个问题来看,您可能希望将它与 Python 2.6 一起使用。如果你只是使用命令

$ easy_install mechanize

it should automatically download the proper egg, if available, or the source and do the necessary build and install steps.

它应该自动下载适当的鸡蛋(如果有)或源代码,并执行必要的构建和安装步骤。

回答by Ashwini Chaudhary

apt-get install python-setuptools

This command will install easy_installon Ubuntu.

此命令将安装easy_install在 Ubuntu 上。

回答by Lennart Regebro

You don't need to download mechanize to install it with easy_install. You just go:

您无需下载 mechanize 即可使用 easy_install 进行安装。你就去:

/path/to/easy_install mechanize

Your problem is that you don't actually call easy_install.

你的问题是你实际上并没有调用easy_install。

bash: easy_install: command not found

That only works if easy_install is installed for the standard Python on your system. evidently you installed it for some other python. Figure out where you actually installed it, and call it with the path. Done!

只有在系统上为标准 Python 安装了 easy_install 时,这才有效。显然你为其他一些python安装了它。找出您实际安装它的位置,并使用路径调用它。完毕!

回答by Cristian

mechanize-0.1.9-py2.5.eggis just a zipped file. Furthermore, you don't need to download the egg manually. easy_installwill automatically pull down the code for you and install it.

mechanize-0.1.9-py2.5.egg只是一个压缩文件。此外,您无需手动下载鸡蛋。easy_install会自动为你下拉代码并安装。

You can install easy_install with ez_setup.py, a bootstrap script they provide.

您可以使用ez_setup.py安装 easy_install,是他们提供的引导脚本。