gpt4 book ai didi

python - 在 Windows 上升级 TensorFlow

转载 作者:太空狗 更新时间:2023-10-30 01:47:43 25 4
gpt4 key购买 nike

如何升级 Windows 机器上的 tensoflow 库? Tensorflow 当前已安装并且运行良好。我正在使用 anaconda 发行版。

import tensorflow as tf

tf.VERSION
Out[37]: '1.2.1'

我的python版本如下

>python -V
Python 3.5.3 :: Anaconda custom (64-bit)

----------------更新 1 ---------------------------- --------------

尝试了第一个答案并收到以下消息

>pip install tensorflow --upgrade
Collecting tensorflow
Downloading tensorflow-1.3.0-cp35-cp35m-win_amd64.whl (25.5MB)
100% |################################| 25.5MB 47kB/s
Collecting protobuf>=3.3.0 (from tensorflow)
Downloading protobuf-3.4.0-py2.py3-none-any.whl (375kB)
100% |################################| 378kB 1.4MB/s
Requirement already up-to-date: numpy>=1.11.0 in c:\users\johndoe\appdata\local\conda\conda\envs\tensorflowspyder\lib\site-packages (from tensorflow)
Collecting tensorflow-tensorboard<0.2.0,>=0.1.0 (from tensorflow)
Downloading tensorflow_tensorboard-0.1.8-py3-none-any.whl (1.6MB)
100% |################################| 1.6MB 591kB/s
Requirement already up-to-date: six>=1.10.0 in c:\users\johndoe\appdata\local\conda\conda\envs\tensorflowspyder\lib\site-packages (from tensorflow)
Collecting wheel>=0.26 (from tensorflow)
Downloading wheel-0.30.0-py2.py3-none-any.whl (49kB)
100% |################################| 51kB 1.2MB/s
Collecting setuptools (from protobuf>=3.3.0->tensorflow)
Downloading setuptools-36.6.0-py2.py3-none-any.whl (481kB)
100% |################################| 481kB 1.1MB/s
Requirement already up-to-date: werkzeug>=0.11.10 in c:\users\johndoe\appdata\local\conda\conda\envs\tensorflowspyder\lib\site-packages (from tensorflow-tensorboard<0.2.0,>=0.1.0->tensorflow)
Requirement already up-to-date: bleach==1.5.0 in c:\users\johndoe\appdata\local\conda\conda\envs\tensorflowspyder\lib\site-packages (from tensorflow-tensorboard<0.2.0,>=0.1.0->tensorflow)
Collecting markdown>=2.6.8 (from tensorflow-tensorboard<0.2.0,>=0.1.0->tensorflow)
Downloading Markdown-2.6.9.tar.gz (271kB)
100% |################################| 276kB 1.5MB/s
Requirement already up-to-date: html5lib==0.9999999 in c:\users\johndoe\appdata\local\conda\conda\envs\tensorflowspyder\lib\site-packages (from tensorflow-tensorboard<0.2.0,>=0.1.0->tensorflow)
Building wheels for collected packages: markdown
Running setup.py bdist_wheel for markdown ... done
Stored in directory: C:\Users\johndoe\AppData\Local\pip\Cache\wheels\bf\46\10\c93e17ae86ae3b3a919c7b39dad3b5ccf09aeb066419e5c1e5
Successfully built markdown
Installing collected packages: setuptools, protobuf, markdown, wheel, tensorflow-tensorboard, tensorflow
Found existing installation: setuptools 36.2.0
Uninstalling setuptools-36.2.0:
Successfully uninstalled setuptools-36.2.0
Rolling back uninstall of setuptools
Exception:
Traceback (most recent call last):
File "C:\Users\johndoe\AppData\Local\conda\conda\envs\tensorflowspyder\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\johndoe\AppData\Local\conda\conda\envs\tensorflowspyder\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "C:\Users\johndoe\AppData\Local\conda\conda\envs\tensorflowspyder\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "C:\Users\johndoe\AppData\Local\conda\conda\envs\tensorflowspyder\lib\site-packages\pip\req\req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "C:\Users\johndoe\AppData\Local\conda\conda\envs\tensorflowspyder\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "C:\Users\johndoe\AppData\Local\conda\conda\envs\tensorflowspyder\lib\site-packages\pip\wheel.py", line 247, in move_wheel_files
prefix=prefix,
File "C:\Users\johndoe\AppData\Local\conda\conda\envs\tensorflowspyder\lib\site-packages\pip\locations.py", line 140, in distutils_scheme
d = Distribution(dist_args)
File "C:\Users\johndoe\AppData\Local\conda\conda\envs\tensorflowspyder\lib\site-packages\setuptools\dist.py", line 365, in __init__
self._finalize_requires()
File "C:\Users\johndoe\AppData\Local\conda\conda\envs\tensorflowspyder\lib\site-packages\setuptools\dist.py", line 372, in _finalize_requires
if not self.install_requires:
AttributeError: 'Distribution' object has no attribute 'install_requires'

我的版本还是一样

----------------更新2---------------------------- ---- 我再次运行相同的命令并收到以下消息

>pip install tensorflow --upgrade
Collecting tensorflow
Using cached tensorflow-1.3.0-cp35-cp35m-win_amd64.whl
Collecting tensorflow-tensorboard<0.2.0,>=0.1.0 (from tensorflow)
Using cached tensorflow_tensorboard-0.1.8-py3-none-any.whl
Requirement already up-to-date: numpy>=1.11.0 in c:\users\johndoe\appdata\local\conda\conda\envs\tensorflowspyder\lib\site-packages (from tensorflow)
Collecting protobuf>=3.3.0 (from tensorflow)
Using cached protobuf-3.4.0-py2.py3-none-any.whl
Requirement already up-to-date: six>=1.10.0 in c:\users\johndoe\appdata\local\conda\conda\envs\tensorflowspyder\lib\site-packages (from tensorflow)
Collecting wheel>=0.26 (from tensorflow)
Using cached wheel-0.30.0-py2.py3-none-any.whl
Requirement already up-to-date: html5lib==0.9999999 in c:\users\johndoe\appdata\local\conda\conda\envs\tensorflowspyder\lib\site-packages (from tensorflow-tensorboard<0.2.0,>=0.1.0->tensorflow)
Collecting markdown>=2.6.8 (from tensorflow-tensorboard<0.2.0,>=0.1.0->tensorflow)
Requirement already up-to-date: bleach==1.5.0 in c:\users\johndoe\appdata\local\conda\conda\envs\tensorflowspyder\lib\site-packages (from tensorflow-tensorboard<0.2.0,>=0.1.0->tensorflow)
Requirement already up-to-date: werkzeug>=0.11.10 in c:\users\johndoe\appdata\local\conda\conda\envs\tensorflowspyder\lib\site-packages (from tensorflow-tensorboard<0.2.0,>=0.1.0->tensorflow)
Collecting setuptools (from protobuf>=3.3.0->tensorflow)
Using cached setuptools-36.6.0-py2.py3-none-any.whl
Installing collected packages: setuptools, protobuf, markdown, wheel, tensorflow-tensorboard, tensorflow
Found existing installation: setuptools 36.2.0
Uninstalling setuptools-36.2.0:
Successfully uninstalled setuptools-36.2.0
Found existing installation: protobuf 3.3.0
Uninstalling protobuf-3.3.0:
Successfully uninstalled protobuf-3.3.0
Found existing installation: Markdown 2.6.8
Uninstalling Markdown-2.6.8:
Successfully uninstalled Markdown-2.6.8
Found existing installation: wheel 0.29.0
Uninstalling wheel-0.29.0:
Successfully uninstalled wheel-0.29.0
Found existing installation: tensorflow 1.2.1
Uninstalling tensorflow-1.2.1:
Successfully uninstalled tensorflow-1.2.1
Successfully installed markdown-2.6.9 protobuf-3.4.0 setuptools-36.6.0 tensorflow-1.3.0 tensorflow-tensorboard-0.1.8 wheel-0.30.0

我查了下好像是tensorflow版本升级了

tf.VERSION
Out[2]: '1.3.0'

最佳答案

像普通包一样升级它:

如果在conda环境下安装了tensorflow

activate your-conda-environment

然后:

pip install pip --upgrade
pip install tensorflow --upgrade

这对我有用。

关于python - 在 Windows 上升级 TensorFlow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46840496/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com