问题
I want to install TensorFlow, I have tried everything from reinstalling everything to trying different versions it doesn't help.
I have tried it with python 3.9.0 and pip version 20.0.3
回答1:
The Official TensorFlow website specifies python 3.5-3.8.
You need to create a new environment as suggested in the previous answer with a new version of python, or uninstall python 3.9 and install other version. I use python 3.6.8 for Tensorflow and it works great.
回答2:
I use Anaconda and I have 2 different versions. This may give you some ideas even if you are not using Anaconda. But Anaconda can help you maintain different environments for different versions.
conda create -n tensorflow23python37-gpu python=3.7
pip install --ignore-installed --upgrade tensorflow-gpu
The command shown above creates a new environment and installs tensorflow.
(tensorflow2) C:\Users\spatial\PycharmProjects\TensorFlow>conda env list
# conda environments:
#
base C:\Anaconda3
ame C:\Anaconda3\envs\ame
tensorflow-cpu C:\Anaconda3\envs\tensorflow-cpu
tensorflow2 * C:\Anaconda3\envs\tensorflow2
(tensorflow-cpu) C:\Users\spatial\PycharmProjects\TensorFlow>python
Python 3.5.5 |Anaconda, Inc.| (default, Apr 7 2018, 04:52:34) [MSC v.1900 64 bit (AMD64)] on wi
n32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf;
C:\Anaconda3\envs\tensorflow-cpu\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversio
n of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, i
t will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
>>> print( tf.__version__);
1.9.0
You could also install version 2 in a new conda environment like this.
(tensorflow2) C:\Users\spatial\PycharmProjects\TensorFlow>pip install "tensorflow>=2.0.0"
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your
Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in Janu
ary 2021. pip 21.0 will remove support for this functionality.
Collecting tensorflow>=2.0.0
(tensorflow2) C:\Users\spatial\PycharmProjects\TensorFlow>python
Python 3.5.6 |Anaconda, Inc.| (default, Aug 26 2018, 16:05:27) [MSC v.1900 64 bit (AMD64)] on wi
n32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf;
>>> print( tf.__version__);
2.3.1
回答3:
I had the similar problem but I am able to resolve it by downloading the python version 3.8.6 and installing it. Please pay attention to add the python and the respective pip path in the environment.
Then give the command, which will install tensorflow version 2.3.1
pip install tensorflow
You may upgrade the pip by following command,
py -m pip install --upgrade pip
I hope that it works for you.
来源:https://stackoverflow.com/questions/64622401/tensorflow-installation-in-python-3-9-064-bit-and-pip-version-20-2-3