将高版本py与tensorflow改变成低版本python以安装低版本tensorflow

搞了两天,看了好多博客,终于找到自己电脑的解决问题了。

之前装不了1.4只能装1.14什么的而且装到一半还会报错,如果直接pip的话又只能默认装tensorflow2.0,好多代码都跑不起来,很烦。

主要参考

https://blog.csdn.net/blueheart20/article/details/78980736

https://blog.csdn.net/wipvip/article/details/82735603

 

查看现在的tensorflow版本

(base) C:\Users\lenovo>pip show tensorflow

Name: tensorflow

Version: 2.0.0

Summary: TensorFlow is an open source machine learning framework for everyone.

Home-page: https://www.tensorflow.org/

Author: Google Inc.

Author-email: [email protected]

License: Apache 2.0

Location: c:\programdata\anaconda3\lib\site-packages

Requires: absl-py, termcolor, wrapt, opt-einsum, google-pasta, wheel, astor, tensorboard, gast, six, keras-applications, protobuf, keras-preprocessing, tensorflow-estimator, grpcio, numpy

Required-by:
 

卸载已有的tensorflow

(base) C:\Users\lenovo>pip uninstall tensorflow

Uninstalling tensorflow-2.0.0:

  Would remove:

    c:\programdata\anaconda3\lib\site-packages\tensorflow-2.0.0.dist-info\*

    c:\programdata\anaconda3\lib\site-packages\tensorflow\*

    c:\programdata\anaconda3\lib\site-packages\tensorflow_core\*

    c:\programdata\anaconda3\scripts\saved_model_cli.exe

    c:\programdata\anaconda3\scripts\tensorboard.exe

    c:\programdata\anaconda3\scripts\tf_upgrade_v2.exe

    c:\programdata\anaconda3\scripts\tflite_convert.exe

    c:\programdata\anaconda3\scripts\toco.exe

    c:\programdata\anaconda3\scripts\toco_from_protos.exe

Proceed (y/n)? y

  Successfully uninstalled tensorflow-2.0.0

对tensorflow的安装文件进行完全的清除(https://blog.csdn.net/wipvip/article/details/82735603

将高版本py与tensorflow改变成低版本python以安装低版本tensorflow_第1张图片

将高版本py与tensorflow改变成低版本python以安装低版本tensorflow_第2张图片

将高版本py与tensorflow改变成低版本python以安装低版本tensorflow_第3张图片

查看自己的python版本号为3.7,然后进行降级到3.6

(输入两次add channels…一长串的… 置顶清华滤镜网站)

(base) C:\Users\lenovo>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

(base) C:\Users\lenovo>conda config --set show_channel_urls yes

(base) C:\Users\lenovo>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

Warning: 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/' already in 'channels' list, moving to the top

 

 

 

设置3.6环境

(base) C:\Users\lenovo>conda create --name py36 python=3.6 anaconda

激活py3.6

(base) C:\Users\lenovo>activate py36

验证环境

(py36) C:\Users\lenovo>python --version

Python 3.6.1 :: Anaconda 4.4.0 (64-bit)

现在就可以安装1.4.0版本啦!!

(py36) C:\Users\lenovo>pip install tensorflow==1.4.0

验证安装成功的版本(期间有报错,但是好像也不影响?)

(py36) C:\Users\lenovo>python

Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.

>>> import tensorflow as tf

>>> tf.__version__

'1.4.0'

           

 

你可能感兴趣的:(python)