Daniel Turon
Daniel Turon

Reputation: 21

Problem importing numpy in Jupyter Notebook

Just yesterday it was working, and it still imports in spyder, but for some reason I cannot import into jupyter notebook.

import numpy as np

gets error message

Traceback (most recent call last):

File "C:\Users\dturo\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3343, in run_code exec(code_obj, self.user_global_ns, self.user_ns)

File "", line 1, in import numpy

File "C:\Users\dturo\anaconda3\lib\site-packages\numpy_init_.py", line 106 """

^ SyntaxError: invalid syntax

Edit_________________________ Issue resolved, somehow the actual init.py file for numpy got changed, so I had to just fix that. Unsure how it happened, I had left my pc running so maybe my cat did some trolling

Upvotes: 0

Views: 2323

Answers (1)

ADA
ADA

Reputation: 26

Try writing this in the jupyter notebook:

import sys
!{sys.executable} -m pip install numpy

Then:

import numpy as np

Upvotes: 0

Related Questions