简体   繁体   中英

Tensorflow not found in python 3.7.8 venv

I have installed tensorflow inside a Python Venv and everything is working. I am using visual studio code to run my script, and when I activate the Venv and run the file with a tensorflow import, I get a ModuleNotFoundError: No module named 'tensorflow' . When I run pip list tensorflow appears and everything is downloaded. The strangest part is that when I type python3 in the terminal and start a shell within the Venv, I can import tensorflow with no issues.

I have restarted VS code several times, and am wondering what could be causing the issue. Could it be a problem with my version of python (3.7.8)?

I had a problem with virtual environment. As I can recall, the solution was to add the correct python.exe path to.vscode/settings.json file:

{
    "python.pythonPath": "c:\\<path to your environment folder>\\Scripts\\python.exe"
}

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