小言_互联网的博客

Tensorflow 1.10.0升至2.0问题memo

554人阅读  评论(0)

Tensorflow从1.10.0升级至2.0,出现问题予以memo。

环境

liumiaocn:~ liumiao$ uname -a
Darwin liumiaocn 18.0.0 Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64
liumiaocn:~ liumiao$

升级前tensorflow版本信息

liumiaocn:tmp liumiao$ pip list
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Package                            Version                
---------------------------------- -----------------------
absl-py                            0.4.1                  
...省略              
tensorboard                        1.10.0                 
tensorflow                         1.10.0                 
termcolor                          1.1.0                  
...省略              
You are using pip version 19.0.3, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
liumiaocn:tmp liumiao$

升级方法

使用pip uninstall之后再install的方法,也可以使用pip install --upgrade的方式。这里使用了uninstall -> install的方式

升级pip

升级命令:pip install --upgrade pip

安装tensorflow

命令:pip uninstall tensorflow
pip install tensorflow

错误信息与对应方法

setuptools版本过低

错误信息提示:
tensorboard 2.0.0 has requirement setuptools>=41.0.0, but you’ll have setuptools 39.1.0 which is incompatible.

  • 原因
    setuptools版本过低,使用pip list可以确认到当前版本信息为:39.1.0

对应方法:升级setuptools即可(升至41.4.0)。
升级命令:pip install --upgrade setuptools

wrapt卸载错误信息提示

错误信息提示:
ERROR: Cannot uninstall ‘wrapt’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

  • 原因
    pip 无法确认是否可以进行卸载,强制重新安装相关依赖与新版即可。

对应方法,执行如下命令升级wrapt扽吧版本
升级命令:pip install -U --ignore-installed wrapt enum34 simplejson netaddr

升级后版本确认

liumiaocn:tmp liumiao$ pip list |grep tensor
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
tensorboard                        2.0.0                  
tensorflow                         2.0.0                  
tensorflow-estimator               2.0.0                  
liumiaocn:tmp liumiao$ 

注:python 2将或在2个月后无法使用上述DEPRECATION尚未对应,升级本地python即可。

  • 版本确认
liumiaocn:~ liumiao$ python
Python 2.7.15 |Anaconda, Inc.| (default, May  1 2018, 18:37:05) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'2.0.0'
>>> 

转载:https://blog.csdn.net/liumiaocn/article/details/102408841
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场