KvaksMan play
KvaksMan play

Reputation: 230

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

Upvotes: 1

Views: 10902

Answers (3)

Marie. P.
Marie. P.

Reputation: 275

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.)

Upvotes: 2

kshitij86
kshitij86

Reputation: 129

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 

Upvotes: 3

Mr Coder
Mr Coder

Reputation: 523

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

Upvotes: 2

Related Questions