我正在尝试使用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没有任何问题。
当前回答
我的环境:Win 10, python 3.6
pip3 install --upgrade tensorflow
pip install --upgrade tensorflow
错误:
> Collecting tensorflow Could not find a version that satisfies the
> requirement tensorflow (from versions: ) No matching distribution
> found for tensorflow
我还尝试了pip install tensorflow和pip install tensorflow-gpu。 但错误:
> Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow
> Could not find a version that satisfies the requirement tensorflow-gpu (from versions: ) No matching distribution found for tensorflow-gpu
使用Step (https://www.tensorflow.org/install/install_windows)尝试安装OK
Follow the instructions on the Anaconda download site to download and install Anaconda. https://www.continuum.io/downloads Create a conda environment named tensorflow by invoking the following command: C:> conda create -n tensorflow pip python=3.5 Activate the conda environment by issuing the following command: C:> activate tensorflow (tensorflow)C:> # Your prompt should change Issue the appropriate command to install TensorFlow inside your conda environment. To install the CPU-only version of TensorFlow, enter the following command: (tensorflow)C:> pip install --ignore-installed --upgrade tensorflow To install the GPU version of TensorFlow, enter the following command (on a single line): (tensorflow)C:> pip install --ignore-installed --upgrade tensorflow-gpu
其他回答
我也遇到过同样的问题,我用这个方法解决了:
# 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不能通过pip安装。我在windows 10上遇到的一个问题是,我的系统路径中没有支持的cudnn版本。截至目前(2017年12月),windows上的tensorflow只支持cudnn v6.1。因此,提供cudnn 6.1的路径,如果其他一切都正确,那么应该安装tensorflow。
当我试图在我的Mac上安装(使用Python 2.7)时,我遇到了同样的错误。根据Yash Kumar Verma在本页上的不同回答,我在这里给出的类似解决方案似乎也适用于Windows 8.1上的Python 3
解决方案
第一步:进入TensorFlow安装页面的TensorFlow Python包的URL部分,复制相关链接的URL用于您的Python安装。
第二步:打开终端/命令提示符,执行以下命令: PIP install -upgrade[在这里粘贴复制的url链接]
所以对我来说是这样的: PIP安装——升级https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.2.0-py2-none-any.whl
更新(2017年7月21日):我和其他一些在Windows机器上运行Python 3.6的人尝试了这一点,他们必须将第2步中的行更改为: Python -m PIP install[在这里粘贴复制的url链接]
更新(2018年7月26日):对于Python 3.6.2(不是3.7,因为在TF文档中的3.6.2中),您还可以在步骤2中使用pip3 install——upgrade[粘贴复制的URL]。
2.0兼容方案:
在终端(Linux/MacOS)或命令提示符(Windows)中执行以下命令,使用Pip安装Tensorflow 2.0:
#Install tensorflow using pip virtual env
pip install virtualenv
virtualenv tf_2.0.0 # tf_2.0.0 is virtual env name
source tf_2.0.0/bin/activate
#You should see tf_2.0.0 Env now. Execute the below steps
pip install tensorflow==2.0.0
python
>>import tensorflow as tf
>>tf.__version__
2.0.0
在终端(Linux/MacOS)或命令提示符(Windows)中执行以下命令,使用Bazel安装Tensorflow 2.0:
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
#The repo defaults to the master development branch. You can also checkout a release branch to build:
git checkout r2.0
#Configure the Build => Use the Below line for Windows Machine
python ./configure.py
#Configure the Build => Use the Below line for Linux/MacOS Machine
./configure
#This script prompts you for the location of TensorFlow dependencies and asks for additional build configuration options.
#Build Tensorflow package
#CPU support
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
#GPU support
bazel build --config=opt --config=cuda --define=no_tensorflow_py_deps=true //tensorflow/tools/pip_package:build_pip_package
更新时间:2016年11月28日:TensorFlow现在可以在PyPI中使用,从0.12版本开始。你可以打字
pip install tensorflow
…或…
pip install tensorflow-gpu
...分别安装TensorFlow的cpu加速版或gpu加速版。
之前的回答:TensorFlow还没有在PyPI存储库中,所以你必须为你的操作系统和Python版本指定适当的“轮子文件”的URL。
TensorFlow网站上列出了支持的配置的完整列表,但例如,要在Linux上仅使用CPU安装Python 2.7的0.10版本,您将键入以下命令:
$ pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp27-none-linux_x86_64.whl