Error: "in module named xxxx"

Asked

Viewed 3,982 times

0

I have Python installed on my Pcs (Windows 7 and 8) but I can’t run any script that contains import.

Error message always appears:

import error: no module named xxxx.

  • 1

    What version of Python is installed? You have tried removing Python and installing it again?

  • 1

    Surely the imported module is correctly installed or is one of the modules that comes by default with python?

  • Hi, thanks for the answers!!! So, I have the 2.7 on one pc and the 3.5 on the other. I have installed and re-installed a thousand times and it doesn’t work :(

  • How can I know if the module is well installed, Rui? (if it is not too difficult to explain)

  • 1

    @Jana what module are you trying to import?

  • This one is one of many that don’t work: import numpy

  • I just tried some modules and they work: >> import os >> import shutil >> import glob

  • 1

    @Jana because these come by default with python

  • Thank you so much, Rui!

  • 1

    @Jana to use numpy you need to install the package first

  • Fabio, Rui e jbueno, super thanks for the answers!!! And I’m sorry I misposed the question. I’m already trying to solve from the answers. An embrace!

  • 1

    @Jana if your operating system is 64 bits you may have some difficulty installing numpy for windows, but I think it is possible.

Show 7 more comments

1 answer

2


You are trying to import modules that do not come "embedded" when you install Python. That means you will have to install them manually.

You can do this by Pip

pip install numpy

Or however you choose.

  • 1

    This response works for many of the modules but the installation of the numpy in Windows is usually much more boring.

  • 1

    I never did this installation on Windows, but apparently AP had no problems... Anyway, I will look into that and try to improve that answer (if it is some immutable behavior).

  • Exactly, sergiopereira. I managed to install nltk easily, but numpy so far nothing... :(

  • 1

    To install numpy on Windows, the easiest is to download already precompiled here and install the wheel file using something like pip install numpy‑1.9.3+mkl‑cp35‑none‑win_amd64.whl. Be careful to download the correct version for your Windows (32 vs 64bit) and Python (2.7 vs 3.x)

  • Long overdue, but never too late to mourn: @sergiopereira, thank you very much! :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.