zoukankan      html  css  js  c++  java
  • ubuntu18.04下安装Anaconda及numpy、matplotlib

    为了学习深度学习,我需要首先掌握利用python进行科学计算的知识,顺便复习一下线性代数、微积分、概率论。当然,现在我要做的是安装Anaconda。

    1、官网下载,linux版本:https://www.anaconda.com/download

    2、如果太慢,可以使用清华的镜像(感谢清华大学提供免费的镜像服务):https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

    3、anacoda默认安装到home目录,还捆绑了vscode(可以选择不安装)。

    4、安装完毕后,需要重新: source .bashrc 

    5、如果是默认安装,使用sudo时,必须使用全路径,否则sudo不能识别conda(基于安全考虑)。

    6、更新conda: sudo `which conda` update -n base conda 

    7、安装numpy和matplotlib:

    sudo `which conda` install numpy
    sudo `which conda` install matplotlib

    8、例子1:

    import numpy as np  
    import matplotlib.pyplot as pt  
    x = np.arange(0 , 360)  
    y = np.sin( x * np.pi / 180.0)  
    pt.plot(x,y)  
    pt.xlim(0,360)  
    pt.ylim(-1.2,1.2)  
    pt.title("SIN function")  
    pt.show()  

    例子2:

    import numpy as np
    import matplotlib.pyplot as pt
    x=np.linspace(-1,1,100)
    y=2*x+np.random.randn(*x.shape)*0.3
    pt.plot(x,y,'ro',label='Original data')
    pt.legend()
    pt.show()
  • 相关阅读:
    OpenGL------光照+染色
    sicily 1345 能量项链
    sicily 1193 Up the Stairs
    sicily 1172 Queens, Knights and Pawns
    sicily 1206 Stacking Cylinders
    模拟退火算法解tsp问题
    js对象的属性可以是一个变量
    vue中/deep/的使用
    MySQL中DATEDIFF函数使用
    js中的this
  • 原文地址:https://www.cnblogs.com/litifeng/p/9103523.html
Copyright © 2011-2022 走看看