我正在尝试使用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没有任何问题。


当前回答

我在conda上安装了tensorflow,但似乎在windows上不起作用,但最终这个命令在cmd上可以正常工作。

 python.exe -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

其他回答

目前PIP没有32位版本的tensorflow,当我卸载python 32位并安装x64时,它可以工作

你需要一个64位版本的Python,在你的情况下,你使用的是32位版本。到目前为止,Tensorflow只支持64位版本的Python 3.5。X和3.8。Windows操作系统。请参阅安装文档以了解当前支持的内容

要检查您正在运行的Python版本,输入Python或python3启动解释器,然后输入import struct;print(struct.calcsize("P") * 8),这将打印32或64来告诉您正在运行的Python的比特版本。

评论:

要下载不同版本的Windows Python,请访问python.org/downloads/windows并向下滚动,直到看到以“64”结尾的版本。这将是64位版本,应该与张量流一起工作

2019年更新: 为了在谷歌Colab中安装TensorFlow 2预览版,您可以使用:

!wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64 -O cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
!dpkg -i cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
!apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub
!apt-get update
!apt-get install cuda
!pip install tf-nightly-gpu-2.0-preview

为了安装TensorFlow 2 bye pip,你可以使用: 为GPU安装tf-night - GPU -2.0-preview PIP安装tf-night -2.0-preview CPU。

我也遇到过同样的问题,我用这个方法解决了:

# 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和keras:

从https://repo.anaconda.com/archive/下载python 3.6附带的Anaconda3-5.2.0 安装Anaconda并打开Anaconda提示符并执行以下命令 Conda安装jupyter Conda安装scipy PIP安装sklearn PIP安装msgpack PIP安装熊猫 PIP安装panda -datareader PIP安装matplotlib PIP安装枕 PIP安装请求 PIP install h5py PIP安装tensorflow PIP安装keras