unable to import tensorflow after I pip install in a virtual environment in python

Viewed 77

my python version is 3.7.5.

In vscode, I created my virtual environment

python -m venv myProj

Then I switch my python interpreter to: python3.7.5 64bit ('myProj':venv)

I install tensorflow as below:

pip install tensorflow

I can see tensorflow appear in the myProj/lib-sitePackages

Then I tried to run python file in which there is one line 'import tensorflow' The prompt became like below: (myProj) C:\Users\xxx\Documents\My_Document\myname\myProj>

I got error like below:

ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.........

Interestingly, when I did pip install tensorflow outside of virtual environment, I was able to run python3.7.5 and import tensorflow.

I spend hours try this and that. But got no success. Do anyone know why it happens?

1 Answers

Run tensorflow in anaconda. Delete and unistall all existing python software and download anaconda.then view tutorials of how to install tensorflow and keras in anaconda. It takes about 20 mins with goodnet speed. I used to get the same dll error load module not found error when tried without anaconda.these are compatibility issues

Related