importorror:没有名为mechaniz的模块

2024-05-15 10:12:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用easy_安装,我输入了:

easy_install mechanize

它返回的最后一行是:

Finished processing dependencies for mechanize

现在当我试图:

import mechanize

我得到这个错误:

ImportError: No module named mechanize

知道怎么了吗?谢谢


Tags: installnoimportfor错误easydependenciesnamed
2条回答

您检查过python shell中的sys.path吗?

>>> import sys
>>> sys.path
# Returns a list of directories & .egg files

为了让python找到mechanize,它需要位于sys.path中列出的位置之一。如果您知道mechanize是在哪里安装的,那么您可以直接检查它是否在sys.path上(我不知道如何找出它是自动安装的)。

这似乎是个棘手的问题。这些相当烦人。以我的经验,对付它们最好的办法就是避开它们。你应该考虑使用virtualenv。它将为您处理python路径问题。

相关问题 更多 >