简体   繁体   中英

How to install TensorFlow on Python 3.7

How to install TensorFlow on Python 3.7

Trying:

D:\Users\Downloads>pip install tensorflow
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow

Windows 10 OS

And with vent error, too

(venv) C:\Users\KvaksManYT>pip install --upgrade tensorflow
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow

you can install Tensorflow follow those steps Ubuntu/Linux /mac os /windows

virtualenv does not require a mention pip version

for system install, you need to mention pip version

upgrade pip version

pip install --upgrade pip

#virtualenv install

pip install --upgrade tensorflow

#system install
pip3 install --user --upgrade tensorflow 

reference https://www.tensorflow.org/install/pip

I would recommend using a virtual environment using pip install vitualenv . Then, depending on your OS, you want to create and activate an environment.

python3 -m venv /path/to/new/virtual/environment

Then, activate this environment using,

source ./venv/bin/activate

Now, you can install any Python packages you want.

pip install tensorflow==2.0.0 

I had the same problem with Windows 10 x64 , and it was caused because I was using the wrong Python version , both globally and in the venv . I found questions on the issue multiple times on the internet, including yours.

Be sure to use Python versions 3.5-3.8, as per requirements , but also x64, not x32 .

Namely, I ran into this error using both

  • a venv with 3.9.1 x64 ( python --version ),
  • and my globally installed 3.8.2 x32 ( python3 --version ).

So, I downloaded the x64-version of Python 3.8.6 from here.

Note that the command venv does not allow specifying the python version used in the virtual environment ,

as per an answer on this question. So I used virtualenv , which I obviously had to install in my global Python version first.

To specify the Python version used in the venv , I used the command virtualenv , as in:

virtualenv --python="C:\Users\me\AppData\Local\Programs\Python\Python38\python.exe myvenv 

where you have to give the path to the newly downloaded Python distribution you want to use, if there are several on your PC (for example, I had Python38-32 and Python39 folders in that directory).

Check Python versions in virtual environment

After I activate my myvenv , created as above, I verify the Python versions as follows:

python3 --version
> Python 3.8.2
python --version
> Python 3.8.6

Then, using the command

import struct
print(struct.calcsize("P") * 8)

Within either python3 or python , shows me whether the version is 32bit or 64bit, as per this answer . The python returns a 64 , so that is the one you want to use (not python3 ).

Finally, within the virtual environment, you can run

pip install --upgrade tensorflow

and it will download and install. (Meanwhile, pip3 install --upgrade tensorflow would still return your error inside and outside the virtual enviroment.)

This is Procedure and installation only for those who use ANACONDA

There are alternative ways that don't need to make it too difficult Please follow my procedure

1)Firstly

Create a new environment just open Anaconda # then click on Environments ## Create a new environment then write environment in the name: Tensor_flow then select Python from dropbox like python3.7 or 3.8 and click on create it will create a tensor_flow environment

Secondly Click on created Tensor_flow environment must select tensor_flow created environments # then click on install it will show all install packages write TensorFlow and click on install TensorFlow ## then select Keras and install Keras

3)Thirdly

Click on Home button # install juptytorNotebook ### lunchJupytorNotebook

Fourthly Now go start the menu search box write Jupiter It will show jupytorNotebok + JupytorNotebookTensorFlow but you must choose for JupytorNotebookTensorFlow so click on JupytorNotebookTensorFlow and then select python to write import TensorFlow as tf also check for from TensorFlow import Keras Thank you if you don't know please let me know I will help you. Follow the following links for complete detalis. https://towardsdatascience.com/https-medium-com-ekapope-v-install-tensorflow-and-keras-using-anaconda-navigator-without-command-line-b0bc41dbd038

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