- conda 常见命令复习:
bash
conda env list // 查看 conda 环境列表
conda activate xxxenv // 进入指定 conda 环境
- 环境展示:
2.1. 我的物理环境的 Python 版本为 3.10.9:

2.2. 我的 conda 虚拟环境 env_yolov9_python_3_8 中的 python 版本是 3.8.19:

- 使用 pycharm 新建使用 conda base 环境 Python 解释器的工程:


如上图所示,在 D:\code\python_code 下新建了一个工程 project_use_conda_base_env。
如下图所示,在该工程下新建一个 test.py 文件输出当前环境的 python 版本,发现就是 conda base 环境的 python 版本:


- 使用 pycharm 新建使用 conda 自定义环境 Python 解释器的工程:

如上图所示,在 D:\code\python_code 下新建了一个使用 env_yolov9_python_3_8 conda 虚拟环境的工程。
在该工程下新建 test.py 输出当前环境的 python 版本:

但是现在 右键 --》run 'test' 提示没有 python 解释器,并且 run 下拉框中也没有发现 conda 自定义虚拟环境 env_yolov9_python_3_8 下的 Python 解释器:

点击 pycharm 右上角的 Configure Python interpreter 来手动添加 env_yolov9_python_3_8 环境的 python 解释器:



此时运行 test.py 输出的 Python 版本就是 env_yolov9_python_3_8 环境的 python 版本了:

