Installing Tensorflow when Python 3.9 is installed on Path?

49,475

Solution 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

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

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

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 5

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/

Share:
49,475
Shashank Walake
Author by

Shashank Walake

Updated on March 07, 2022

Comments

  • Shashank Walake
    Shashank Walake about 2 years

    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.

    • Divyessh
      Divyessh over 3 years
      source the path to the bin of python
    • Djib2011
      Djib2011 over 3 years
      which python do you want to install tensorflow for?
    • hoefling
      hoefling over 3 years
      py -3.8 -m pip install tensorflow
    • danihelovij
      danihelovij about 3 years
      @hoefling It works, thank you
    • usman mohammed
      usman mohammed almost 3 years
  • Suthiro
    Suthiro over 3 years
    I suppose it will use python3.9, isn't it?
  • RobbieTheK
    RobbieTheK over 3 years
    This appears to be for Mac OS. I got this error on Fedora: ImportError: /usr/local/lib/python3.9/site-packages/tensorflow/python/_py‌​wrap_tensorflow_inte‌​rnal.so: invalid ELF header During handling of the above exception, another exception occurred:
  • EpixyCoder101
    EpixyCoder101 over 3 years
    @RobbieTheK that's odd.. seems to work on my Windows system.
  • brunocrt
    brunocrt about 3 years
    the last command worked for me because I was using Python 3.9 and will only work with the most recent version/builds of tensorflow (tf-nightly) thanks for the help!