'Installing Tensorflow when Python 3.9 is installed on Path?

2 Versions of Python 3.9 and 3.8.6 are installed on Win 10. I Also want Tensorflow installed. But Pip recognises only Py 3.9 and hence does not installs tf locally. Is there a way out for this.



Solution 1:[1]

Try this command

python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl

Solution 2:[2]

python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl

This work with my python 3.9

Solution 3:[3]

The following command should be work for python version 3.9: python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl

Solution 4:[4]

For dealing with multiple Python Versions it is highly recommended to use virtual environments. It makes live much easier. For a detailed guide how to set them up read this: https://www.freecodecamp.org/news/manage-multiple-python-versions-and-virtual-environments-venv-pyenv-pyvenv-a29fb00c296f/

Solution 5:[5]

This worked for me:

python3.8 -m pip install tensorflow

I think pip uses the latest python version, so you have to tell pip to install with python3.8 or use the beta version of tensorflow:

pip install tf-nightly

Solution 6:[6]

Change you're Environment variable from python 3.9 to python 3.8.6 .

1.search for environment variables in your pc see the pic --->. Environment variables

2.Now select environment variables option see pic --->. click on option

  1. Now edit the path of wanted python see pic --->. Edit

Solution 7:[7]

Your system is defaulting to python 3.9 because it is higher up in the system path list, so it is seen first. search for environment variable in windows then click on environment variable. Then under system variable, search for path and then move the python3.8 higher up than python3.9. Your system will now see 3.8 as default.

Solution 8:[8]

I did two things to make it work.

  1. After pip install tensorflow, restarted my VS Code
  2. Change the interpreter from 3.9 to 3.7, so it started installing ipython relevant packages and then changed it back to 3.9.

Not sure it works for you.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tomash
Solution 2 M-Chen-3
Solution 3 Fazlul Hoque
Solution 4 Sathish Guru V
Solution 5 DapperDuck
Solution 6 ItsAshishSingh
Solution 7 elotech
Solution 8 Karthikeyan VK