Python 更新 TensorFlow

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42574476/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 21:54:42  来源:igfitidea点击:

Update TensorFlow

pythontensorflowdeep-learningupgrade

提问by Brm-Covi?io

I'm working with Ubuntu 14.04, I had a TensorFlow V0.10but I want to update this version. if i do:

我正在使用Ubuntu 14.04,我有一个,TensorFlow V0.10但我想更新这个版本。如果我做:

$ pip install --upgrade $TF_BINARY_URL

but it prints:

但它打印:

Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1198, in prepare_files
    do_download,
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1376, in unpack_url
    self.session,
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 572, in unpack_http_url
    download_hash = _download_url(resp, link, temp_location)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 433, in _download_url
    for chunk in resp_read(4096):
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 421, in resp_read
    chunk_size, decode_content=False):
  File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py", line 225, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py", line 174, in read
    data = self._fp.read(amt)
  File "/usr/lib/python2.7/httplib.py", line 573, in read
    s = self.fp.read(amt)
  File "/usr/lib/python2.7/socket.py", line 380, in read
    data = self._sock.recv(left)
  File "/usr/lib/python2.7/ssl.py", line 341, in recv
    return self.read(buflen)
  File "/usr/lib/python2.7/ssl.py", line 260, in read
    return self._sslobj.read(len)
SSLError: The read operation timed out

Storing debug log for failure in /home/brm17/.pip/pip.log

回答by Panfeng Li

(tensorflow)$ pip install --upgrade pip  # for Python 2.7
(tensorflow)$ pip3 install --upgrade pip # for Python 3.n

(tensorflow)$ pip install --upgrade tensorflow      # for Python 2.7
(tensorflow)$ pip3 install --upgrade tensorflow     # for Python 3.n
(tensorflow)$ pip install --upgrade tensorflow-gpu  # for Python 2.7 and GPU
(tensorflow)$ pip3 install --upgrade tensorflow-gpu # for Python 3.n and GPU

(tensorflow)$ pip install --upgrade tensorflow-gpu==1.4.1 # for a specific version

Details on install tensorflow.

有关安装 tensorflow 的详细信息。

回答by Salvador Dali

To upgrade any python package, use pip install <pkg_name> --upgrade.

要升级任何 python 包,请使用pip install <pkg_name> --upgrade.

So in your case it would be pip install tensorflow --upgrade. Just updated to 1.1.0

所以在你的情况下它会是pip install tensorflow --upgrade. 刚刚更新到1.1.0

回答by 0xAliHn

This is official recommendation for upgrading Tensorflow.

这是升级 Tensorflow 的官方建议。

To get TensorFlow 1.5, you can use the standard pip installation (or pip3 if you use python3)

要获得 TensorFlow 1.5,您可以使用标准的 pip 安装(如果您使用 python3,则可以使用 pip3)

$  pip install --ignore-installed --upgrade tensorflow

回答by Harish Kumawat

Tensorflow upgrade -Python3

Tensorflow 升级-Python3

>> pip3 install --upgrade tensorflow --user

if you got this

如果你有这个

"ERROR: tensorboard 2.0.2 has requirement grpcio>=1.24.3, but you'll have grpcio 1.22.0 which is incompatible."

“错误:tensorboard 2.0.2 要求 grpcio>=1.24.3,但您将拥有不兼容的 grpcio 1.22.0。”

Upgrade grpcio

升级 grpcio

>> pip3 install --upgrade grpcio --user

回答by Jeereddy

Upgrading to Tensorflow 2.0 using pip. Requires Python > 3.4 and pip >= 19.0

使用 pip 升级到 Tensorflow 2.0。需要 Python > 3.4 和 pip >= 19.0

CST:~ USERX$ pip3 show tensorflow
Name: tensorflow
Version: 1.13.1

CST:~ USERX$ python3 --version
Python 3.7.3

CST:~ USERX$ pip3 install --upgrade tensorflow

CST:~ USERX$ pip3 show tensorflow
Name: tensorflow
Version: 2.0.0

回答by Akash

Before trying to update tensorflow try updating pip

在尝试更新 tensorflow 之前尝试更新 pip

pip install --upgrade pip

If you are upgrading from a previous installation of TensorFlow < 0.7.1, you should uninstall the previous TensorFlowand protobufusing,

如果您从之前安装的 TensorFlow < 0.7.1 升级,您应该使用以下命令卸载之前的TensorFlowprotobuf

pip uninstall tensorflow

to make sure you get a clean installation of the updated protobuf dependency.

以确保您获得更新的 protobuf 依赖项的全新安装。

Uninstall the TensorFlow on your system, and check out Download and Setup to reinstall again.

在您的系统上卸载 TensorFlow,并查看下载和设置以重新安装

If you are using pip install, go check the available version over https://storage.googleapis.com/tensorflow, search keywords with linux/cpu/tensorflow to see the availabilities.

如果您使用 pip install,请通过https://storage.googleapis.com/tensorflow检查可用版本,使用 linux/cpu/tensorflow 搜索关键字以查看可用性。

Then, set the path for download and execute in sudo.

然后,设置下载路径并在sudo中执行。

$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0-py2-none-any.whl

$ sudo pip install --upgrade $TF_BINARY_URL

For more detail, follow this link in here

有关更多详细信息,请点击此处的链接

回答by kmario23

For anaconda installation, first pick a channelwhich has the latest version of tensorflow binary. Usually, the latest versions are available at the channel conda-forge. Then simply do:

对于Anaconda安装,首先选择一个通道,其具有最新版本tensorflow二进制的。通常,最新版本可在频道 中获得conda-forge。然后简单地做:

conda update -f -c conda-forge tensorflow

This will upgrade your existing tensorflow installation to the very latest version available. As of this writing, the latest version is 1.4.0-py36_0

这会将您现有的 tensorflow 安装升级到可用的最新版本。在撰写本文时,最新版本是1.4.0-py36_0