Python安装及环境配置

Henry Lv3

安装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/

  • 3.安装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
      2
      3
      4
          conda install -c conda-forge transformers
      ```y

      - 4.关闭环境
      conda deactivate
      1
      2
        - 
      - 查看已经安装的库

查看所有安装的的库

conda list
# 查找特定库
conda list | findstr pandas
conda list | findstr jieba
conda list | findstr scikit-learn
conda list | findstr pytorch
conda list | findstr torch
```

  • 标题: Python安装及环境配置
  • 作者: Henry
  • 创建于 : 2026-01-13 09:53:20
  • 更新于 : 2026-01-26 21:10:06
  • 链接: https://mybetterworks.github.io/2026/01/13/Python安装及环境配置/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论