【Python-Tensorflow】ERROR: Could not find a version that satisfies the requirement tensorflow

简介: 本文讨论了在安装TensorFlow时遇到的版本兼容性问题,并提供了根据Python版本选择正确pip版本进行安装的解决方法。

1 问题

通过以下命令执行安装TensorFlow时,报错ERROR: Could not find a version that satisfies the requirement tensorflow,警告找不到这个TensorFlow的版本,但是实际上这个版本是存在。

pip install tensorflow-gpu==1.15

2 问题分析

因为Pip版本对应的Python版本下没有这个版本的tensorflow。
当前指令下的Python版本没有选择对。通过执行命令

pip -V

可以查看到该pip对应的python版本是2.7,在Python2.7版本下,是没有tensorflow1.15版本的。那需要使用Python3.6的pip去安装TensorFlow1.15

3 解决办法

第一种情况(有pip3.6)

查看是否有pip3.6

pip3.6 -V

如果有直接使用pip3.6安装TensorFlow

pip3.6 install tensorflow-gpu==1.15

第二种情况(没有pip3.6)

如果有以上步骤执行成功,此步骤跳过
(1)第一步:下载安装Pip的脚本

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

(1) 第二步:安装python3.6版本的pip

python3.6 get-pip.py

(3) 第三步:查看是否安装成功

pip3.6 -V

(4) 第四步:指定pip3.6 执行安装tensorflow

pip3.6 install tensorflow-gpu==1.15

4 附录命令(无关解决Error)

(1)查看当前环境下的Python2版本有哪些

ls /System/Library/Frameworks/Python.framework/Versions

2.3 2.5 2.6 2.7 Current

(2)查看当前环境下的Python3版本有哪些

ls /Library/Frameworks/Python.framework/Versions

3.5 3.6
(3)卸载TensorFlow

sudo pip uninstall tensorflow==1.15

(4)删除某个版本的Python,参考《MacOS下彻底删除多余的Python版本》。

目录
相关文章
|
并行计算 TensorFlow 算法框架/工具
Tensorflow error(三):failed to get convolution algorithm,cuDNN failed to initialize
这篇文章讨论了TensorFlow在进行卷积操作时可能遇到的“failed to get convolution algorithm”错误,通常由于cuDNN初始化失败引起,并提供了几种解决方案,包括调整GPU内存使用策略和确保CUDA、cuDNN与TensorFlow版本兼容性。
451 1
Tensorflow error(三):failed to get convolution algorithm,cuDNN failed to initialize
|
索引 Python
Python中的find()和count()方法详解
Python中的find()和count()方法详解
1012 3
|
数据安全/隐私保护 Python
Python 解压还密码的压缩文件 LookupError: Couldn't find path to unrar library.
Python 解压还密码的压缩文件 LookupError: Couldn't find path to unrar library.
517 2
|
JavaScript 前端开发 Python
成功解决:Can‘t find Python executable “python“, you can set the PYTHON env variable.
这篇文章分享了作者在运行前端Vue项目时遇到的关于Python执行环境的问题和解决方法。问题是由于找不到Python可执行文件导致的编译错误,解决方法包括安装编译环境、卸载并重新安装出现问题的`node-sass`包,并重新执行`npm install`和`npm run dev`。
成功解决:Can‘t find Python executable “python“, you can set the PYTHON env variable.
|
机器学习/深度学习 Linux TensorFlow
【Tensorflow 2】解决tensorflow.python.framework.errors_impl.UnknownError: [_Derived_] Fail to find the...
本文解决了在使用TensorFlow 2.0和Keras API时,尝试使用双向LSTM (tf.keras.layers.Bidirectional) 出现的未知错误问题,并提供了三种解决该问题的方法。
666 3
|
Python
【Python】解决Can‘t find model ‘en‘. It doesn‘t seem to be a shortcut link, a Python package or a valid
在使用以下代码时,报错Can’t find model ‘en’. It doesn’t seem to be a shortcut link, a Python package or a valid path to a data directory.
336 1
|
TensorFlow 算法框架/工具
Tensorflow error(二):x and y must have the same dtype, got tf.float32 != tf.int32
本文讨论了TensorFlow中的一个常见错误,即在计算过程中,变量的数据类型(dtype)不一致导致的错误,并通过使用`tf.cast`函数来解决这个问题。
371 0
|
Python Windows
Python:执行py命令,提示: Can‘t find a default Python.
Python:执行py命令,提示: Can‘t find a default Python.
|
机器学习/深度学习 API TensorFlow
【Tensorflow+keras】解决 Fail to find the dnn implementation.
在TensorFlow 2.0环境中使用双向长短期记忆层(Bidirectional LSTM)遇到“Fail to find the dnn implementation”错误时的三种解决方案。
358 0
|
Python
【Python 3】解决FeatureNotFound: Couldn‘t find a tree builder with the features you requested: lxml.
文章讨论了在使用Python的BeautifulSoup库时遇到的"Couldn't find a tree builder with"错误,并提供了解决方案。
1158 0

推荐镜像

更多