zoukankan      html  css  js  c++  java
  • windows下安装anaconda和tensorflow

    anaconda确实很好用,省去了很多麻烦,现在我个人推荐直接使用anaconda。

    anaconda的特点:可以存在多个python环境,要使用某一个环境的话,就需要切换到这个环境,安装、卸载包都是在某一个特定的环境下进行的。所谓环境其实就是在不同的目录下安装不同的python和包而已,而切换环境就是切换一下目录。

    基本操作:

    创建一个python3.4环境:
    conda create --name python34 python=3.4
    
    激活:
    activate python34 # for Windows
    source activate python34 # for Linux & Mac
    
    # 如果想返回默认的环境,运行
    deactivate python34 # for Windows
    source deactivate python34 # for Linux & Mac
    
    #列出所有环境
    conda env list
    
    
    # 删除一个已有的环境
    conda remove --name python34 --all
    

    补充:

    anaconda具体安装流程和使用方法请参考:https://blog.csdn.net/ITLearnHall/article/details/81708148

    连接vscode:

    同样点击左下角的齿轮,选择comand palette, 在里面选择python解释器,就会自动连接anaconda的环境了。(在安装的时候注意要勾选推荐选项)

    解决powershell中禁止执行脚本的办法:以管理员权限打开powershell,然后执行Set-ExecutionPolicy -ExecutionPolicy RemoteSigned命令

    详细情况参考:https://blog.csdn.net/qq_42739865/article/details/88855495

    自带的jupyter如何切换kernel:

    conda create -n py3 python=3 # 创建一个python3的环境,名为py3
    activate py3 # 激活py3环境
    conda install ipykernel # 安装ipykernel模块
    python -m ipykernel install --user --name py3 --display-name "py3" # 进行配置
    jupyter notebook # 启动jupyter notebook,然后在"新建"中就会有py3这个kernel了 

    安装包

    可以使用conda或者pip安装,但是要注意用什么安装就用什么卸载并且要保证conda和pip是同一环境下的,不要装错了,因为有些包可能只在pip上提供,不在conda上提供

    安装tensorflow:

    安装cpu版本:在对应的环境下输入

    pip install --upgrade --ignore-installed tensorflow

    如果报错缺少msgpack,pip安装即可

    如果出现一下错误:Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问:就在install后加上 --user

    运行程序出现一下警告: Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2

    解决办法参考:https://blog.csdn.net/hq86937375/article/details/79696023

  • 相关阅读:
    topcoder srm 445 div1
    topcoder srm 440 div1
    topcoder srm 435 div1
    topcoder srm 430 div1
    topcoder srm 400 div1
    topcoder srm 380 div1
    topcoder srm 370 div1
    topcoder srm 425 div1
    WKWebView强大的新特性
    Runtime那些事
  • 原文地址:https://www.cnblogs.com/mlgjb/p/10927887.html
Copyright © 2011-2022 走看看