You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

InstallPython.md 4.4 kB

4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. # 安装Python环境
  2. 由于Python的库比较多,并且依赖关系比较复杂,所以请仔细阅读下面的说明,并按下面的说明来操作,减少问题出现的可能。 **但是所列的安装方法说明里有较多的细节,也许和你的系统并不适配,所以可能会遇到问题。如果遇到问题请通过搜索引擎去查找解决的办法**,并通过这个方式锻炼自己解决问题的能力。
  3. 可以参考后面所列的`1.Winodws`或者`2.Linux`章节所列的将Python环境安装到计算机里。
  4. ## 1. Windows下安装
  5. 由于Anaconda集成了大部分的python包,因此能够很方便的开始使用。由于网络下载速度较慢,因此推荐使用镜像来提高下载的速度。镜像的使用方法可以参考:[Anaconda镜像的说明文档](https://mirrors.bfsu.edu.cn/help/anaconda/)
  6. 1. 在下列镜像网站找到适合自己的安装文件,然后下载
  7. * https://mirrors.bfsu.edu.cn/anaconda/archive/
  8. * https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
  9. * https://mirrors.aliyun.com/anaconda/archive/
  10. * https://mirrors.hit.edu.cn/anaconda/archive/
  11. 例如: https://mirrors.bfsu.edu.cn/anaconda/archive/Anaconda3-2020.11-Windows-x86_64.exe
  12. 2. 按照说明,把Anaconda安装好。
  13. ## 2. Linux下安装
  14. 在网站下载最新的conda安装文件,例如
  15. ```
  16. wget https://mirrors.bfsu.edu.cn/anaconda/archive/Anaconda3-2020.11-Linux-x86_64.sh
  17. ```
  18. 然后运行
  19. ```
  20. bash ./Anaconda3-2020.11-Linux-x86_64.sh
  21. ```
  22. 按照提示完成安装(记得需要`自动加入环境变量`的设置),**然后关闭终端,再打开终端**
  23. ## 3. 设置软件源
  24. ### 3.1 设置conda软件源
  25. 参考这里的[conda安装和软件源设置说明](https://mirrors.bfsu.edu.cn/help/anaconda/)
  26. 各系统都可以通过修改用户目录下的 `.condarc` 文件。Windows 用户无法直接创建名为 `.condarc` 的文件,可先执行 `conda config --set show_channel_urls yes` 生成该文件之后再修改。
  27. Linux下,打开文件编辑器 `gedit ~/.condarc`,然后把下面的内容拷贝到这个文件中:
  28. ```
  29. channels:
  30. - defaults
  31. show_channel_urls: true
  32. default_channels:
  33. - https://mirrors.bfsu.edu.cn/anaconda/pkgs/main
  34. - https://mirrors.bfsu.edu.cn/anaconda/pkgs/r
  35. - https://mirrors.bfsu.edu.cn/anaconda/pkgs/msys2
  36. custom_channels:
  37. conda-forge: https://mirrors.bfsu.edu.cn/anaconda/cloud
  38. msys2: https://mirrors.bfsu.edu.cn/anaconda/cloud
  39. bioconda: https://mirrors.bfsu.edu.cn/anaconda/cloud
  40. menpo: https://mirrors.bfsu.edu.cn/anaconda/cloud
  41. pytorch: https://mirrors.bfsu.edu.cn/anaconda/cloud
  42. pytorch-lts: https://mirrors.bfsu.edu.cn/anaconda/cloud
  43. simpleitk: https://mirrors.bfsu.edu.cn/anaconda/cloud
  44. ```
  45. ### 3.2 设置PIP源
  46. ```
  47. pip config set global.index-url 'https://pypi.mirrors.ustc.edu.cn/simple/'
  48. ```
  49. ## 4. 安装常用软件
  50. 打开`conda`的命令行程序,输入下面的命令
  51. ```
  52. conda install jupyter scipy numpy sympy matplotlib pandas scikit-learn
  53. ```
  54. ## 5. 安装PyTorch
  55. ```
  56. conda install pytorch -c pytorch
  57. pip3 install torchvision
  58. ```
  59. ## 6. Conda使用技巧
  60. ### 6.1 Conda创建自己的环境
  61. ```
  62. conda create -n <your_env>
  63. # example
  64. conda create -n machinelearning
  65. ```
  66. ### 6.2 Conda怎么激活自己的环境
  67. ```
  68. conda activate <your_env>
  69. # example
  70. conda activate machinelearning
  71. ```
  72. ### 6.3 Conda常用命令
  73. ```
  74. # 帮助命令
  75. conda -h
  76. conda help
  77. # 配置频道(已有)
  78. conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/
  79. # 退出当前环境
  80. conda deactivate
  81. # 查看基本信息
  82. conda info
  83. conda info -h
  84. # 查看当前存在环境
  85. conda env list
  86. conda info --envs
  87. # 删除环境
  88. conda remove -n <your_env> --all
  89. ```
  90. ## 7. 安装nvidia驱动
  91. ### 7.1 查看已有的nvidia驱动
  92. ```
  93. dpkg -l | grep -i nvidia
  94. ```
  95. ### 7.2 卸载驱动
  96. ```
  97. sudo apt-get purge nvidia-driver-xxx
  98. ```
  99. ### 7.3 搜索并安装的驱动
  100. ```
  101. apt-cache search nvidia | grep 460
  102. sudo apt-get install nvidia-driver-460
  103. ```
  104. 根据自己的需要可以安装更高的版本。
  105. #### 7.4 Conda使用cuda
  106. ```
  107. conda install cudatoolkit=8.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/
  108. ```
  109. **根据自己的需要安装更高的版本**
  110. ## 8. [Python技巧](python/)
  111. - [pip的安装、使用等](python/pip.md)
  112. - [virtualenv的安装、使用](python/virtualenv.md)
  113. - [virtualenv便捷管理工具:virtualenv_wrapper](python/virtualenv_wrapper.md)

机器学习越来越多应用到飞行器、机器人等领域,其目的是利用计算机实现类似人类的智能,从而实现装备的智能化与无人化。本课程旨在引导学生掌握机器学习的基本知识、典型方法与技术,通过具体的应用案例激发学生对该学科的兴趣,鼓励学生能够从人工智能的角度来分析、解决飞行器、机器人所面临的问题和挑战。本课程主要内容包括Python编程基础,机器学习模型,无监督学习、监督学习、深度学习基础知识与实现,并学习如何利用机器学习解决实际问题,从而全面提升自我的《综合能力》。