我正在尝试使用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没有任何问题。
当前回答
告诉你具体是什么问题的方法是:
PIP install -vvv tensorflow
这将向您显示可用的轮子文件以及它们不匹配的原因。
如果你执行pip debug -verbose,它会显示所有兼容的标签。
在我的例子中,我试图在一个多通道ubuntu实例的m1 mac上安装tensorflow,而需要https://pypi.org/project/tensorflow-aarch64/
其他回答
如果你的命令pip install——upgrade tensorflowcompililes,那么你的tensorflow版本应该是最新的。我个人更喜欢用水蟒。tensorflow可以简单地安装和升级:
conda install -c conda-forge tensorflow # to install
conda upgrade -c conda-forge tensorflow # to upgrade
另外,如果你想用你的GPU使用它,你有一个简单的安装:
conda install -c anaconda tensorflow-gpu
我已经用了一段时间了,从来没有任何问题。
我发现这个方法终于管用了。
python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl
编辑1:这是在Windows (8,8.1, 10), Mac和Linux上测试的。根据您的配置将python3更改为python。如果使用Python 2.x,则将url中的py3更改为py2。
编辑2:不同版本的列表,如果有人需要:https://storage.googleapis.com/tensorflow
编辑3:可用轮子包的url列表可在这里: https://www.tensorflow.org/install/pip#package-location
对于pyCharm用户:
检查pip版本: pip3 - v 如果pip大于9.0.1: Py -3 -m PIP install——升级PIP 然后: Py -3 -m PIP install——upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl
我的环境: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
注意:这个答案是针对Cygwin用户的
留下这个答案是因为这里的其他方法都不适合我的用例(使用*nix-on-Windows终端环境在virtualenv上安装tensorflow, cygwin (http://www.cygwin.com/))(至少在答案页面上一个简单的控件+F没有找到任何东西)。
TLDR:如果您在cygwin终端上使用virtualenv,请了解cygwin似乎在安装tensorflow时遇到了问题,并抛出了本文问题中指定的错误(可以在这里(https://stackoverflow.com/a/45230106/8236733)找到类似的情绪(类似的原因,不同的错误))。通过在Windows命令提示符中创建virtualenv来解决。然后可以通过source ./Scripts/activate从cygwin终端访问/激活virtualenv,使用Windows的(不是cygwin的)python。
当只是使用cygwin的python3尝试使用tensorflow,例如。之类的……
apt-cyg install python3-devel
cd python-virtualenv-base
virtualenv -p `which python3` tensorflow-examples
发现使用cygwin的python安装tensorflow-gpu包时存在一些问题。看到了错误
$ PIP install tensorflow 收集tensorflow 无法找到满足tensorflow要求的版本 没有找到匹配的分布张量流
有许多建议的解决方案,没有一个对我的情况有帮助(它们通常都是沿着“您可能已经安装了用于32位架构的python3, tensorflow需要64位”或其他一些python不匹配的错误(而在这里,似乎只是cygwin的python安装tensorflow-gpu有问题))。
最后对我有用的是……
通过Windows系统的官方Windows方式安装python3 (cygwin系统是独立的,因此使用不同的python) 在Windows(不是cygwin终端)中打开命令提示符,然后执行…
C:\Users\me\python-virtualenvs-base>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
C:\Users\me\python-virtualenvs-base>pip -V
pip 9.0.1 from c:\users\me\appdata\local\programs\python\python36\lib\site-packages (python 3.6)
C:\Users\me\python-virtualenvs-base>pip install virtualenv
Collecting virtualenv
Downloading https://files.pythonhosted.org/packages/b6/30/96a02b2287098b23b875bc8c2f58071c35d2efe84f747b64d523721dc2b5/virtualenv-16.0.0-py2.py3-none-any.whl (1.9MB)
100% |████████████████████████████████| 1.9MB 435kB/s
Installing collected packages: virtualenv
Successfully installed virtualenv-16.0.0
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Users\me\python-virtualenvs-base>virtualenv tensorflow-examples
Using base prefix 'c:\\users\\me\\appdata\\local\\programs\\python\\python36'
New python executable in C:\Users\me\python-virtualenvs-base\tensorflow-examples\Scripts\python.exe
Installing setuptools, pip, wheel...done.
然后,可以返回cygwin终端,导航回您在命令提示符中创建的virtualenv,并执行…
➜ tensorflow-examples source ./Scripts/activate
(tensorflow-examples) ➜ tensorflow-examples python -V
Python 3.6.2
(tensorflow-examples) ➜ tensorflow-examples pip install tensorflow-gpu
Collecting tensorflow-gpu
Downloading
....
注意,如果您在cygwin的伪linux环境中创建了virtualenv,那么您不会在virtualenv中执行source ./bin/activate,而是执行source ./Scripts/activate。