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:
- [Solved] Importerror: DLL load failed while importing mtrand: the specified program could not be found.
- [Solved] pytorchImportError: numpy.core.multiarray failed to import
- How to Solve Anaconda Error (Three Errors to Solve)
- [Solved] “import numpy as np” ImportError: No module named numpy
- Pycharm Error: ImportError: No module named model_selection
- only size-1 arrays can be converted to Python scalars
- Error reporting of importing tensorflow package from pycharm
- face_ Face recognition error report
- The Usage of Numpy.unravel_index() function
- After tensorflow is installed, an error occurred during import: importerror: DLL load failed: the specified module cannot be found