SoFunction
Updated on 2024-11-17

How Python 3.8 solves the No module named 'numpy' error problem

Python 3.8 solves the No module named 'numpy' error.

report an error

settle (a dispute)

python -m pip install --upgrade pippip install numpy

(pip is a python package management tool)

Just install and run pythonimport numpy without errors.

If it doesn't work (force install a newer, higher version)

sudo pip install numpy --ignore-installed numpy

Mac solve sublime can not call Numpy (No module named *)

contexts

The mac has python3 and Numpy properly installed.

Numpy or other mods can be called correctly via IDLE and terminal encoding, but there is a No module named numpy issue in Sublime.

method settle an issue

1) Open a terminal and type type -a python3.

Copy the first line, /Library/Frameworks//Versions/3.8/bin/python3

2) Open Sublime, click Tools->Build System->New Build System...

3) Delete the intermediate statement and replace it with "cmd" ["/Library/Frameworks//Versions/3.8/bin/python3", "-u", "$file"].

Note that the content in the first " " of the square brackets is the path copied in 1)!

4) Click File->save as to change the file name to -build (the path does not need to be changed)

5) Click View->Syntax->Python in turn

6) Click Tools->Build System->Python3 in order

Re-open Sublime, you can run Numpy in Python3 perfectly, other downloaded mods can be debugged in this way.

summarize

The above is a personal experience, I hope it can give you a reference, and I hope you can support me more.