提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
@TOC
前言
提示:这里可以添加本文要记录的大概内容:
例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。
提示:以下是本篇文章正文内容,下面案例可供参考
一、Anaconda和Python
Anaconda(download web,目前已更新到2023.09版本)是一个开源的、跨平台的数据科学工具包,在Windows,Linux,Mac上均可安装使用,它包含了Python解释器以及大量用于数据分析和科学计算的第三方库和工具。
1.win系统Anaconda的安装
(1)anaconda的下载
①第一种下载方式(官网)
进入官网下载:Free Download | Anaconda
点击Download即可。
(2)Anaconda的安装
双击打开下载好的安装程序,点击【Next】。
选择自定义安装目录
到这里,Anaconda的安装基本完成。(网上有很多教程Anaconda安装与使用 conda换源 pip换源)
(3)Anaconda环境变量配置
将以下路径添加到【Path】中,请按照自己的实际路径进行添加!
E:\Data_anaconda2023
E:\Data_anaconda2023 \Scripts
E:\Data_anaconda2023 \Library\mingw-w64\bin
E:\Data_anaconda2023 \Library\usr\bin
E:\Data_anaconda2023 \Library\bin
完成之后,点击【确定】即可。
至此完成Anaconda的环境变量配置。
(4)检查安装情况
使用win+R键,输入cmd;在打开的窗口中输入:
conda --version
可以看到版本号
(5)conda镜像源的配置
我将给大家提供一个我一直在使用的镜像源:
清华镜像源
相信你已经在之前的下载中见到这个名词了,使用它的话你只需修改下述文件的对应内容C:\Users\35372\.condarc
该文件为conda的配置文件,右键选择打开方式,使用txt打开即可。
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
deepmodeling: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
注意不要将你的pkgs_dir和envs_dir覆盖掉。操作完成之后ctrl+s保存,关闭文件即可。
操作完成后,同样在Anaconda Prompt中运行conda info,你将在channel URLs一栏中看到以下信息:
(6)pip镜像源配置
与conda相同,pip同样是python的一个包管理工具,在你使用conda创建新的虚拟环境时,它会随着虚拟环境的创建一同下载到环境中,有时conda不能安装的包可以使用pip来进行安装。
①临时使用pip清华镜像源
pip install pkg_name -i https://pypi.tuna.tsinghua.edu.cn/simple
②永久配置pip清华镜像源(全局修改)
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
(7