使用 easy_install 安装 mechanize
我刚刚下载了 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
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.
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
此命令将在 Ubuntu 上安装
easy_install
。This command will install
easy_install
on Ubuntu.在 OS X 上,Python 解释器实例通常作为所谓的框架构建进行安装,这意味着框架内有一个 bin 目录,该目录通常(但并非总是)Python 脚本的安装目标,例如如
easy_install
。如果您没有使用 Apple 提供的 python(在 /usr/bin/ 中),它有自己的easy_install
实例,则应确保所需 python 的框架 bin 目录位于您的 shell 搜索中PATH 并位于/usr/bin
之前。特别是,如果您使用的是 python.org 安装程序安装的 python,您的 PATH 应该如下所示:这确保首先找到正确的
easy_install
。如果您使用的是 MacPorts python,它应该如下所示:编辑:顺便说一句,您下载的 Egg 似乎适用于 Python 2.5,从上一个问题来看,您可能希望将其与 python 2.6 一起使用。如果您只使用该命令,
它应该自动下载适当的 Egg(如果可用)或源代码,并执行必要的构建和安装步骤。
On OS X, Python interpreter instances are typically installed as so-called Framework builds which means that there is a
bin
directory within the framework which is typically (but not always) the installation destination for python scripts, such aseasy_install
. If you are not using the Apple-supplied python (in /usr/bin/) which has its owneasy_install
instance 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:That ensures that the proper
easy_install
will be found first. If you are using a MacPorts python, it should look like this: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
it should automatically download the proper egg, if available, or the source and do the necessary build and install steps.
您无需下载 mechanize 即可使用 easy_install 进行安装。你只要走:
你的问题是你实际上没有调用easy_install。
仅当系统上安装了标准 Python 的 easy_install 时,这才有效。显然你为其他一些Python安装了它。找出你实际安装它的位置,并使用路径调用它。完毕!
You don't need to download mechanize to install it with easy_install. You just go:
Your problem is that you don't actually call easy_install.
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!
mechanize-0.1.9-py2.5.egg
只是一个压缩文件。此外,您不需要手动下载egg。easy_install
会自动为您下载代码并安装。您可以使用他们提供的引导脚本 ez_setup.py 安装 easy_install。
mechanize-0.1.9-py2.5.egg
is just a zipped file. Furthermore, you don't need to download the egg manually.easy_install
will automatically pull down the code for you and install it.You can install easy_install with ez_setup.py, a bootstrap script they provide.