Search code examples
pythonnumpytensorflowvisual-studio-codemodule

No module name 'tensorflow'


The requirements for the code to run is

I have python 2.7.8 by checking python --version. Installing them on python website also lead to a message saying there is no software to install so I assumed that I already have python 2.7x

For tensorflow I have install it using pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py3-none-any.whl

and for Scipy and numpy i did brew install numpy scipy ipython jupyter

I have a python env setup call mypython.

Using pip list I have the following modules install as shown in the image.

But still VScode prompt an error and say that No module named 'tensorflow'when i run the code file.

How do I solve this?

enter image description here


Solution

    1. Install Python extension instead of MagicPython;
    2. You're using mypython in integrated Terminal but in left bottom corner, you select the global one,which is python3.10.1 as interpreter. Open Command Palette and choose Python: Select Interpreter, select mypython then reload window,the error should go away