我正在尝试使用pip安装TensorFlow:
$ pip install tensorflow --user
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
我做错了什么?到目前为止,我使用Python和pip没有任何问题。
我正在尝试使用pip安装TensorFlow:
$ pip install tensorflow --user
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
我做错了什么?到目前为止,我使用Python和pip没有任何问题。
当前回答
如果你正在使用Anaconda Python安装,pip install tensorflow将给出上面所述的错误,如下所示:
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
根据TensorFlow安装页面,当运行pip install时,你需要使用——ignore-installed标志。
然而,在此之前,请参阅此链接 确保TF_BINARY_URL变量与你想要安装的TensorFlow版本相关的设置正确。
其他回答
这是我的环境(Windows 10与NVIDIA GPU)。我想安装TensorFlow 1.12-gpu,多次失败,但能够通过以下方法解决。
这有助于在Windows 10系统上安装TensorFlow-GPU
步骤:
确保你有NVIDIA显卡
a.打开windows资源管理器,打开设备管理器—>,检查“Display” 适配器”—>它将显示(例如NVIDIA GeForce)如果你有GPU它 将显示“高清图形” b.如果GPU是AMD的,那么tensorflow不支持AMD的GPU
如果您有GPU,请检查GPU是否支持CUDA特性。
a.如果你在这个链接找到你的GPU型号,那么它支持CUDA。 b.如果你没有CUDA GPU,那么你只能安装 Tensorflow(不带gpu)
Tensorflow要求python-64bit版本。卸载所有python依赖项
a.进入控制面板->搜索“程序和功能”,然后 搜索“python” b.卸载anaconda和任何与python相关的插件。 这些依赖关系可能会干扰tensorflow-GPU 安装。 c.确保python已经卸载。打开命令提示符并键入 " python ",如果它抛出一个错误,那么你的系统没有python和 您可以继续重新安装python
重新安装python
a.TF1.12支持最高至Python 3.6.6。请按此处下载视窗 X86-64可执行安装程序 b.安装时,选择“Add Python 3.6 to PATH”,然后单击 “现在安装”。
c. python安装成功后,进入安装界面 方法之一,提供禁用路径长度限制的选项 Windows 10中Tensorflow构建/安装问题的根本原因 环境。单击“禁用路径长度限制”,然后执行 完成安装的说明。
d.检查python是否正确安装。打开命令提示符 然后输入“python”。它应该显示Python的版本。
安装Visual Studio
Visual Studio 2017社区
a.点击上方的“Visual Studio链接”。下载Visual Studio 2017社区。 b.在左侧“Visual Studio IDE”下,选择“community 2017” 下载它 c.在安装过程中,选择“Desktop development with c++” 安装
CUDA 9.0工具箱
https://developer.nvidia.com/cuda-90-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal
a.点击上方“CUDA 9.0工具包链接”,下载“Base Installer” b.安装CUDA 9.0
安装 cuDNN
https://developer.nvidia.com/cudnn
a. Click "Link to Install cuDNN" and select “I Agree To the Terms of the cuDNN Software License Agreement” b. Register for login, check your email to verify email address c. Click “cuDNN Download” and fill a short survey to reach “cuDNN Download” page d. Select “ I Agree To the Terms of the cuDNN Software License Agreement” e. Select “Download cuDNN v7.5.0 (Feb 21, 2019), for CUDA 9.0" f. In the dropdown, click “cuDNN Library for Windows 10” and download g. Go to the folder where the file was downloaded, extract the files
h.将解压缩文件中的三个文件夹(bin、include、lib)添加到 环境
i.在windows 10搜索栏中输入“environment”,找到 在“环境变量”中,单击“用户变量”中的“路径” 点击“编辑”,然后选择“新建”,将这三条路径添加到 三个“cuda”文件夹 j.关闭“环境变量”窗口。
安装tensorflow-gpu
a.打开命令提示符,输入“pip install” ——升级tensorflow-gpu” b.安装tensorflow-gpu
检查安装是否正确
a.在命令提示符下输入“python” b.输入“import tensorflow as tf” c你好=特遣部队。常数(“Hello World !”) d .税= tf.Session () e. print(sess.run(hello))——> hello World!
测试tensorflow是否使用GPU
A.从tensorflow.python.client导入device_lib print (device_lib.list_local_devices ()) b . print (device_lib.list_local_devices ())
为了解决这个错误,你可能需要先升级pip,然后安装TensorFlow,如下所示
# Requires the latest pip
pip install --upgrade pip
# Current stable release for CPU and GPU
pip install tensorflow
如果你使用蟒蛇提示,那么试试这个
conda install -c anaconda tensorflow-gpu
对于窗口,您可以使用以下命令
python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-2.3.0-cp38-cp38-win_amd64.whl
我也遇到过同样的问题,我用这个方法解决了:
# Ubuntu/Linux 64-bit, CPU only, Python 2.7
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp27-none-linux_x86_64.whl
# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
# Mac OS X, CPU only, Python 2.7:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py2-none-any.whl
# Mac OS X, GPU enabled, Python 2.7:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.1-py2-none-any.whl
# Ubuntu/Linux 64-bit, CPU only, Python 3.4
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp34-cp34m-linux_x86_64.whl
# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.1-cp34-cp34m-linux_x86_64.whl
# Ubuntu/Linux 64-bit, CPU only, Python 3.5
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp35-cp35m-linux_x86_64.whl
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.1-cp35-cp35m-linux_x86_64.whl
# Mac OS X, CPU only, Python 3.4 or 3.5:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py3-none-any.whl
# Mac OS X, GPU enabled, Python 3.4 or 3.5:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.1-py3-none-any.whl
加:
# Python 2
(tensorflow)$ pip install --upgrade $TF_BINARY_URL
# Python 3
(tensorflow)$ pip3 install --upgrade $TF_BINARY_URL
在Docs上找到。
更新!
有新版本的新链接
例如,要在OSX中安装tensorflow v1.0.0,你需要使用:
https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py2-none-any.whl
而不是
https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py2-none-any.whl
摘自tensorflow网站 https://www.tensorflow.org/install/install_windows
Installing with native pip If the following version of Python is not installed on your machine, install it now: Python 3.5.x from python.org TensorFlow only supports version 3.5.x of Python on Windows. Note that Python 3.5.x comes with the pip3 package manager, which is the program you'll use to install TensorFlow. To install TensorFlow, start a terminal. Then issue the appropriate pip3 install command in that terminal. To install the CPU-only version of TensorFlow, enter the following command:
C:\> pip3 install --upgrade tensorflow
To install the GPU version of TensorFlow, enter the following command:
C:\> pip3 install --upgrade tensorflow-gpu