[Python] Unable to import a module that is definitely installed

Discussão em 'Python' iniciado por Stack, Abril 7, 2025.

  1. Stack

    Stack Membro Participativo

    After installing mechanize, I don't seem to be able to import it.

    I have tried installing from pip, easy_install, and via python setup.py install from the GitHub repository. But however I try it, I have no success at the interactive Python prompt:

    Python 2.7.3 (default, Aug 1 2012, 05:14:39)
    [GCC 4.6.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import mechanize
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: No module named mechanize
    >>>


    The installations I ran previously reported that they had completed successfully, so I expect the import to work.

    What could be causing this error?


    See also: pip installs packages successfully, but executables not found from command line for the case where the code can be imported, but executables (or wrapper scripts) included with the package can't be found at the command line. Either way this is fundamentally an environment setup issue.

    Continue reading...

Compartilhe esta Página