将高版本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: packages@tensorflow.org

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

打开LIb文件夹

找到site-packages 文件 打开

删除掉文件夹里关于TensorFlow相关的文件以及Tensorboard文件

查看自己的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'

           

 

  • 9
    点赞
  • 36
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值