Pycharm introduces numpy error: ImportError: Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy.

The software is pychar with Anaconda installed

My initial error was that numpy could not be called in pychar, and the error was modulenotfounderror: no module named ‘numpy’. This problem was solved by the blog. In fact, we need to use Anaconda’s python.exe

But when you run the code:

import numpy as np

arr = np.random.randint(1, 9, size=9)
print(arr)

The following error occurred again:

File “C:\python\Anaconda3\lib\site-packages\numpy\core\__ init__. py”, line 26, in < module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you’re working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.

Or error, after their own exploration, found a solution, the original version of their numpy is too low! The solution is as follows:

 

How to update?The best way is to use anacon to update all of them uniformly without making mistakes. The method is as follows:

Step 1: first, start cmd.exe as an administrator
Step 2: to upgrade CONDA (you need to upgrade CONDA before upgrading Anaconda) is: CONDA update CONDA
Step 3: to upgrade anconda is: CONDA update Anaconda
Step 4: to upgrade Spyder is: CONDA update Spyder

Step 3: to upgrade Anaconda

Then restart pychar and run the code:

import numpy as np

arr = np.random.randint(1, 9, size=9)
print(arr)

Finally it worked! And when you type pycharm there are also function parameters and other prompts, by the way in the windows environment: ctrl+p will come up with parameter prompts.
Run the results.

[1 2 2 4 7 1 8 7 4]

Similar Posts: