使用 easy_install 安装 mechanize

发布于 2024-08-19 17:23:12 字数 493 浏览 3 评论 0原文

我刚刚下载了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

谁的年少不轻狂 2024-08-26 17:23:12
apt-get install python-setuptools

此命令将在 Ubuntu 上安装 easy_install

apt-get install python-setuptools

This command will install easy_install on Ubuntu.

一枫情书 2024-08-26 17:23:12

在 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

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

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

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

$ easy_install mechanize

它应该自动下载适当的 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 as easy_install. If you are not using the Apple-supplied python (in /usr/bin/) which has its own easy_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:

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

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

$ 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

$ easy_install mechanize

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

绝不服输 2024-08-26 17:23:12

您无需下载 mechanize 即可使用 easy_install 进行安装。你只要走:

/path/to/easy_install mechanize

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

bash: easy_install: command not found

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

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

/path/to/easy_install mechanize

Your problem is that you don't actually call 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!

扶醉桌前 2024-08-26 17:23:12

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文