简体   繁体   中英

Python modules not found in Sublime IDE

I am using Sublime IDE for development. When I'm building my code on Sublime on Ubuntu 18.04, it gives me an error saying:

ImportError: No module named numpy

I have installed numpy on my system and it works just fine when I run it on the terminal.

How do I get the code to build successfully on Sublime itself? Thanks in advance.

It usually happens when you have installed numpy in a different version of Python. Like you are using Python3 but numpy is installed in Python2. So Try to reinstall numpy by specifying the Python version. Try:

python3 -m pip install numpy

this will install numpy using Python3 and you will be able to use it in your IDE.

As @Oleg said, the interpreter on my terminal and on Sublime were different.

https://askubuntu.com/questions/1103987/how-to-change-python-version-in-sublime-ubuntu-18

Used the above link to change the default interpreter for Sublime.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM