Python安装及环境配置
安装Python环境
- 安装方式(windows)
- 1.通过官网安装包安装
- 2.Anaconda/Miniconda
- 3.winget微软官方包管理器
- 4.pyenv-win多版本管理工具安装
Anaconda安装
- 下载安装包
- 链接: https://pan.baidu.com/s/14nimUhTYaWqueK7rg3nOJA?pwd=h5ff
- 软件包安装
- 注意:勾选Add Anaconda to the system PATH environment variable
- 检查是否安装成功,新建cmd窗口并运行:
1
conda -V
- 虚拟环境创建和使用
- 1.新建名称为py312的python版本为3.12的环境:
1
conda create -n py312 python=3.12
- 2.激活环境
1
conda activate py312
- 3.设置镜像源
1
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- 4.安装python库
- 安装 numpy
1
pip install numpy
- 安装 pandas
1
pip install pandas
- 安装jieba
1
pip install jieba
- 安装 scikit-learn
1
conda install scikit-learn
- 安装 pytorch
1
pip install torch torchvision torchaudio
- 安装openai
1
conda install openai -c conda-forge
- 安装 matplotlib
1
conda install matplotlib
- 安装transformer
1
conda install -c conda-forge transformers
- 5.关闭环境
1
conda deactivate
1 | conda -V |
1 | conda create -n py312 python=3.12 |
1 | conda activate py312 |
1 | conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ |
1 | pip install numpy |
1 | pip install pandas |
1 | pip install jieba |
1 | conda install scikit-learn |
1 | pip install torch torchvision torchaudio |
1 | conda install openai -c conda-forge |
1 | conda install matplotlib |
1 | conda install -c conda-forge transformers |
1 | conda deactivate |
- 查看已经安装的库
- 备份环境
- 先进入要备份的环境
1
conda activate py310
- 运行命令
1
conda create --name py310_test --clone py310
- 先进入要备份的环境
1 | # 查看所有安装的的库 |
-
- 标题: Python安装及环境配置
- 作者: Henry
- 创建于 : 2026-01-13 09:53:20
- 更新于 : 2026-03-02 09:28:49
- 链接: https://mybetterworks.github.io/2026/01/13/Python安装及环境配置/
- 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论