No module named numpy

Asked

Viewed 8,794 times

3

porco1 =    [1,1,0]
porco2 =    [1,1,0]
porco3 =    [1,1,0]
cachorro1 = [1,1,1]
cachorro2 = [0,1,1]
cachorro3 = [0,1,1]

dados = [porco1, porco2, porco3, cachorro1, cachorro2, cachorro3]

marcacoes = [1, 1, 1, -1, -1, -1]

misterioso = [1, 1, 1]

from sklearn.naive_bayes import MultinomialNB

modelo = MultinomialNB()
modelo.fit(dados, marcacoes)
print(ntmodelo.predict(misterioso))

I am trying to run this code in Python, but always appears this error. Can anyone help me please inserir a descrição da imagem aqui

  • 4

    From the message, it looks like the library numpy is not installed. Try running the command python -m pip install numpy or pip install numpy

  • 2

    Instead of posting a photo of the error make the selection and copy and paste here, pictures of codes and errors are not always useful

1 answer

3

You need to install the NumPy.

If you already have the pip installed, just run the following command:

pip install numpy

If you don’t own the pip installed yet, you need to download the get-Pip.py.

Then you need to run the file you just downloaded.

Example:

python get-pip.py

Browser other questions tagged

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