Featured image of post Python虚拟环境管理器miniforge

Python虚拟环境管理器miniforge

Python虚拟环境管理器miniforge

1. 概述

Snipaste_2025-10-25_18-31-46.png

  • 测试环境CentOS Linux release 7.9.2009 (Core)

2. 安装miniforge

2.1 下载安装文件

我下载Miniforge3-25.3.1-0-Linux-x86_64.shMiniforge3-25.3.1-0-Linux-x86_64.sh.sha256。下载完成后,校验一下哈希值:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  25/10/2025   18:33.50   /drives/d/Downloads  sha256sum Miniforge3-25.3.1-0-Linux-x86_64.sh
376b160ed8130820db0ab0f3826ac1fc85923647f75c1b8231166e3d559ab768  Miniforge3-25.3.1-0-Linux-x86_64.sh

  25/10/2025   18:34.04   /drives/d/Downloads  cat Miniforge3-25.3.1-0-Linux-x86_64.sh.sha256
376b160ed8130820db0ab0f3826ac1fc85923647f75c1b8231166e3d559ab768  ./Miniforge3-25.3.1-0-Linux-x86_64.sh

  25/10/2025   18:34.52   /drives/d/Downloads  sha256sum -c Miniforge3-25.3.1-0-Linux-x86_64.sh.sha256
./Miniforge3-25.3.1-0-Linux-x86_64.sh: OK

Snipaste_2025-10-25_18-37-25.png

将文件上传到Linux服务器上面root家目录。

上传完成后校验一下文件:

1
2
3
4
5
[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
[root@localhost ~]# sha256sum -c Miniforge3-25.3.1-0-Linux-x86_64.sh.sha256
./Miniforge3-25.3.1-0-Linux-x86_64.sh: OK
[root@localhost ~]#

可以看到文件校验正常。

给脚本文件增加可执行权限:

1
2
3
[root@localhost ~]# chmod u+x Miniforge3-25.3.1-0-Linux-x86_64.sh
[root@localhost ~]# ll -h Miniforge3-25.3.1-0-Linux-x86_64.sh
-rwxr--r-- 1 root root 90M Oct 25 19:32 Miniforge3-25.3.1-0-Linux-x86_64.sh

2.2 配置conda清华大学代理加速

参考Anaconda 镜像使用帮助

创建~/.condarc配置文件,并在其中增加以下配置信息:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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/

配置好后,查看文件内容:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
[root@localhost ~]# cat .condarc
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/

[root@localhost ~]#

2.3 安装miniforge

安装miniforge:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## 查看帮助信息
[root@localhost ~]# ./Miniforge3-25.3.1-0-Linux-x86_64.sh -h

usage: ./Miniforge3-25.3.1-0-Linux-x86_64.sh [options]

Installs Miniforge3 25.3.1-0
-b           run install in batch mode (without manual intervention),
             it is expected the license terms (if any) are agreed upon
-f           no error if install prefix already exists
-h           print this help message and exit
-p PREFIX    install prefix, defaults to /root/miniforge3, must not contain spaces.
-s           skip running pre/post-link/install scripts
-u           update an existing installation
-t           run package tests after installation (may install conda-build)

[root@localhost ~]#

将miniforge安装到/srv/miniforge目录下,并且安装过程中不需要手动交互确认:

1
./Miniforge3-25.3.1-0-Linux-x86_64.sh -b -p /srv/miniforge

安装过程如下:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
[root@localhost ~]# ./Miniforge3-25.3.1-0-Linux-x86_64.sh -b -p /srv/miniforge
PREFIX=/srv/miniforge
Unpacking payload ...
Extracting _libgcc_mutex-0.1-conda_forge.tar.bz2
Extracting ca-certificates-2025.7.14-hbd8a1cb_0.conda
Extracting ld_impl_linux-64-2.44-h1423503_1.conda
Extracting libgomp-15.1.0-h767d61c_3.conda
Extracting pybind11-abi-4-hd8ed1ab_3.tar.bz2
Extracting python_abi-3.12-8_cp312.conda
Extracting tzdata-2025b-h78e105d_0.conda
Extracting _openmp_mutex-4.5-2_gnu.tar.bz2
Extracting libgcc-15.1.0-h767d61c_3.conda
Extracting c-ares-1.34.5-hb9d3cd8_0.conda
Extracting libexpat-2.7.1-hecca717_0.conda
Extracting libffi-3.4.6-h2dba641_1.conda
Extracting libgcc-ng-15.1.0-h69a702a_3.conda
Extracting libiconv-1.18-h4ce23a2_1.conda
Extracting liblzma-5.8.1-hb9d3cd8_2.conda
Extracting libnsl-2.0.1-hb9d3cd8_1.conda
Extracting libstdcxx-15.1.0-h8f9b012_3.conda
Extracting libzlib-1.3.1-hb9d3cd8_2.conda
Extracting ncurses-6.5-h2d0b736_3.conda
Extracting openssl-3.5.1-h7b32b05_0.conda
Extracting reproc-14.2.5.post0-hb9d3cd8_0.conda
Extracting bzip2-1.0.8-h4bc722e_7.conda
Extracting cpp-expected-1.1.0-hff21bea_1.conda
Extracting fmt-11.1.4-h07f6e7f_1.conda
Extracting keyutils-1.6.1-h166bdaf_0.tar.bz2
Extracting libedit-3.1.20250104-pl5321h7949ede_0.conda
Extracting libev-4.33-hd590300_2.conda
Extracting libsolv-0.7.34-h9463b59_0.conda
Extracting libssh2-1.11.1-hcf80075_0.conda
Extracting libstdcxx-ng-15.1.0-h4852527_3.conda
Extracting libuuid-2.38.1-h0b41bf4_0.conda
Extracting libxcrypt-4.4.36-hd590300_1.conda
Extracting lz4-c-1.10.0-h5888daf_1.conda
Extracting lzo-2.10-hd590300_1001.conda
Extracting readline-8.2-h8c095d6_2.conda
Extracting reproc-cpp-14.2.5.post0-h5888daf_0.conda
Extracting simdjson-3.12.3-h84d6215_0.conda
Extracting tk-8.6.13-noxft_hd72426e_102.conda
Extracting yaml-cpp-0.8.0-h3f2d84a_0.conda
Extracting zstd-1.5.7-hb8e6e7a_2.conda
Extracting icu-75.1-he02047a_0.conda
Extracting krb5-1.21.3-h659f571_0.conda
Extracting libnghttp2-1.64.0-h161d5f1_0.conda
Extracting nlohmann_json-3.11.3-he02047a_1.conda
Extracting libcurl-8.14.1-h332b0f4_0.conda
Extracting libsqlite-3.50.3-hee844dc_1.conda
Extracting libxml2-2.13.8-h4bc477f_0.conda
Extracting libarchive-3.7.7-h75ea233_4.conda
Extracting python-3.12.11-h9e4cc4f_0_cpython.conda
Extracting libmamba-2.1.1-h430c389_0.conda
Extracting menuinst-2.3.1-py312h7900ff3_0.conda
Extracting archspec-0.2.5-pyhd8ed1ab_0.conda
Extracting boltons-25.0.0-pyhd8ed1ab_0.conda
Extracting brotli-python-1.1.0-py312h2ec8cdc_3.conda
Extracting certifi-2025.7.14-pyhd8ed1ab_0.conda
Extracting charset-normalizer-3.4.2-pyhd8ed1ab_0.conda
Extracting colorama-0.4.6-pyhd8ed1ab_1.conda
Extracting distro-1.9.0-pyhd8ed1ab_1.conda
Extracting frozendict-2.4.6-py312h66e93f0_0.conda
Extracting hpack-4.1.0-pyhd8ed1ab_0.conda
Extracting hyperframe-6.1.0-pyhd8ed1ab_0.conda
Extracting idna-3.10-pyhd8ed1ab_1.conda
Extracting jsonpointer-3.0.0-py312h7900ff3_1.conda
Extracting libmambapy-2.1.1-py312h07448e0_0.conda
Extracting mamba-2.1.1-had4a41a_0.conda
Extracting packaging-25.0-pyh29332c3_1.conda
Extracting platformdirs-4.3.8-pyhe01879c_0.conda
Extracting pluggy-1.6.0-pyhd8ed1ab_0.conda
Extracting pycosat-0.6.6-py312h66e93f0_2.conda
Extracting pycparser-2.22-pyh29332c3_1.conda
Extracting pysocks-1.7.1-pyha55dd90_7.conda
Extracting ruamel.yaml.clib-0.2.8-py312h66e93f0_1.conda
Extracting setuptools-80.9.0-pyhff2d567_0.conda
Extracting truststore-0.10.1-pyh29332c3_0.conda
Extracting wheel-0.45.1-pyhd8ed1ab_1.conda
Extracting cffi-1.17.1-py312h06ac9bb_0.conda
Extracting h2-4.2.0-pyhd8ed1ab_0.conda
Extracting jsonpatch-1.33-pyhd8ed1ab_1.conda
Extracting pip-25.1.1-pyh8b19718_0.conda
Extracting ruamel.yaml-0.18.14-py312h66e93f0_0.conda
Extracting tqdm-4.67.1-pyhd8ed1ab_1.conda
Extracting zstandard-0.23.0-py312h66e93f0_2.conda
Extracting conda-package-streaming-0.12.0-pyhd8ed1ab_0.conda
Extracting urllib3-2.5.0-pyhd8ed1ab_0.conda
Extracting requests-2.32.4-pyhd8ed1ab_0.conda
Extracting conda-package-handling-2.4.0-pyh7900ff3_2.conda
Extracting conda-25.3.1-py312h7900ff3_1.conda
Extracting conda-libmamba-solver-25.3.0-pyhd8ed1ab_0.conda

Installing base environment...

Transaction

  Prefix: /srv/miniforge

  Updating specs:

   - _libgcc_mutex==0.1=conda_forge
   - ca-certificates==2025.7.14=hbd8a1cb_0
   - ld_impl_linux-64==2.44=h1423503_1
   - libgomp==15.1.0=h767d61c_3
   - pybind11-abi==4=hd8ed1ab_3
   - python_abi==3.12=8_cp312
   - tzdata==2025b=h78e105d_0
   - _openmp_mutex==4.5=2_gnu
   - libgcc==15.1.0=h767d61c_3
   - c-ares==1.34.5=hb9d3cd8_0
   - libexpat==2.7.1=hecca717_0
   - libffi==3.4.6=h2dba641_1
   - libgcc-ng==15.1.0=h69a702a_3
   - libiconv==1.18=h4ce23a2_1
   - liblzma==5.8.1=hb9d3cd8_2
   - libnsl==2.0.1=hb9d3cd8_1
   - libstdcxx==15.1.0=h8f9b012_3
   - libzlib==1.3.1=hb9d3cd8_2
   - ncurses==6.5=h2d0b736_3
   - openssl==3.5.1=h7b32b05_0
   - reproc==14.2.5.0post0=hb9d3cd8_0
   - bzip2==1.0.8=h4bc722e_7
   - cpp-expected==1.1.0=hff21bea_1
   - fmt==11.1.4=h07f6e7f_1
   - keyutils==1.6.1=h166bdaf_0
   - libedit==3.1.20250104=pl5321h7949ede_0
   - libev==4.33=hd590300_2
   - libsolv==0.7.34=h9463b59_0
   - libssh2==1.11.1=hcf80075_0
   - libstdcxx-ng==15.1.0=h4852527_3
   - libuuid==2.38.1=h0b41bf4_0
   - libxcrypt==4.4.36=hd590300_1
   - lz4-c==1.10.0=h5888daf_1
   - lzo==2.10=hd590300_1001
   - readline==8.2=h8c095d6_2
   - reproc-cpp==14.2.5.0post0=h5888daf_0
   - simdjson==3.12.3=h84d6215_0
   - tk==8.6.13=noxft_hd72426e_102
   - yaml-cpp==0.8.0=h3f2d84a_0
   - zstd==1.5.7=hb8e6e7a_2
   - icu==75.1=he02047a_0
   - krb5==1.21.3=h659f571_0
   - libnghttp2==1.64.0=h161d5f1_0
   - nlohmann_json==3.11.3=he02047a_1
   - libcurl==8.14.1=h332b0f4_0
   - libsqlite==3.50.3=hee844dc_1
   - libxml2==2.13.8=h4bc477f_0
   - libarchive==3.7.7=h75ea233_4
   - python==3.12.11=h9e4cc4f_0_cpython
   - libmamba==2.1.1=h430c389_0
   - menuinst==2.3.1=py312h7900ff3_0
   - archspec==0.2.5=pyhd8ed1ab_0
   - boltons==25.0.0=pyhd8ed1ab_0
   - brotli-python==1.1.0=py312h2ec8cdc_3
   - certifi==2025.7.14=pyhd8ed1ab_0
   - charset-normalizer==3.4.2=pyhd8ed1ab_0
   - colorama==0.4.6=pyhd8ed1ab_1
   - distro==1.9.0=pyhd8ed1ab_1
   - frozendict==2.4.6=py312h66e93f0_0
   - hpack==4.1.0=pyhd8ed1ab_0
   - hyperframe==6.1.0=pyhd8ed1ab_0
   - idna==3.10=pyhd8ed1ab_1
   - jsonpointer==3.0.0=py312h7900ff3_1
   - libmambapy==2.1.1=py312h07448e0_0
   - mamba==2.1.1=had4a41a_0
   - packaging==25.0=pyh29332c3_1
   - platformdirs==4.3.8=pyhe01879c_0
   - pluggy==1.6.0=pyhd8ed1ab_0
   - pycosat==0.6.6=py312h66e93f0_2
   - pycparser==2.22=pyh29332c3_1
   - pysocks==1.7.1=pyha55dd90_7
   - ruamel.yaml.clib==0.2.8=py312h66e93f0_1
   - setuptools==80.9.0=pyhff2d567_0
   - truststore==0.10.1=pyh29332c3_0
   - wheel==0.45.1=pyhd8ed1ab_1
   - cffi==1.17.1=py312h06ac9bb_0
   - h2==4.2.0=pyhd8ed1ab_0
   - jsonpatch==1.33=pyhd8ed1ab_1
   - pip==25.1.1=pyh8b19718_0
   - ruamel.yaml==0.18.14=py312h66e93f0_0
   - tqdm==4.67.1=pyhd8ed1ab_1
   - zstandard==0.23.0=py312h66e93f0_2
   - conda-package-streaming==0.12.0=pyhd8ed1ab_0
   - urllib3==2.5.0=pyhd8ed1ab_0
   - requests==2.32.4=pyhd8ed1ab_0
   - conda-package-handling==2.4.0=pyh7900ff3_2
   - conda==25.3.1=py312h7900ff3_1
   - conda-libmamba-solver==25.3.0=pyhd8ed1ab_0


  Package                         Version  Build               Channel         Size
─────────────────────────────────────────────────────────────────────────────────────
  Install:
─────────────────────────────────────────────────────────────────────────────────────

  + _libgcc_mutex                     0.1  conda_forge         conda-forge
  + _openmp_mutex                     4.5  2_gnu               conda-forge
  + archspec                        0.2.5  pyhd8ed1ab_0        conda-forge
  + boltons                        25.0.0  pyhd8ed1ab_0        conda-forge
  + brotli-python                   1.1.0  py312h2ec8cdc_3     conda-forge
  + bzip2                           1.0.8  h4bc722e_7          conda-forge
  + c-ares                         1.34.5  hb9d3cd8_0          conda-forge
  + ca-certificates             2025.7.14  hbd8a1cb_0          conda-forge
  + certifi                     2025.7.14  pyhd8ed1ab_0        conda-forge
  + cffi                           1.17.1  py312h06ac9bb_0     conda-forge
  + charset-normalizer              3.4.2  pyhd8ed1ab_0        conda-forge
  + colorama                        0.4.6  pyhd8ed1ab_1        conda-forge
  + conda                          25.3.1  py312h7900ff3_1     conda-forge
  + conda-libmamba-solver          25.3.0  pyhd8ed1ab_0        conda-forge
  + conda-package-handling          2.4.0  pyh7900ff3_2        conda-forge
  + conda-package-streaming        0.12.0  pyhd8ed1ab_0        conda-forge
  + cpp-expected                    1.1.0  hff21bea_1          conda-forge
  + distro                          1.9.0  pyhd8ed1ab_1        conda-forge
  + fmt                            11.1.4  h07f6e7f_1          conda-forge
  + frozendict                      2.4.6  py312h66e93f0_0     conda-forge
  + h2                              4.2.0  pyhd8ed1ab_0        conda-forge
  + hpack                           4.1.0  pyhd8ed1ab_0        conda-forge
  + hyperframe                      6.1.0  pyhd8ed1ab_0        conda-forge
  + icu                              75.1  he02047a_0          conda-forge
  + idna                             3.10  pyhd8ed1ab_1        conda-forge
  + jsonpatch                        1.33  pyhd8ed1ab_1        conda-forge
  + jsonpointer                     3.0.0  py312h7900ff3_1     conda-forge
  + keyutils                        1.6.1  h166bdaf_0          conda-forge
  + krb5                           1.21.3  h659f571_0          conda-forge
  + ld_impl_linux-64                 2.44  h1423503_1          conda-forge
  + libarchive                      3.7.7  h75ea233_4          conda-forge
  + libcurl                        8.14.1  h332b0f4_0          conda-forge
  + libedit                  3.1.20250104  pl5321h7949ede_0    conda-forge
  + libev                            4.33  hd590300_2          conda-forge
  + libexpat                        2.7.1  hecca717_0          conda-forge
  + libffi                          3.4.6  h2dba641_1          conda-forge
  + libgcc                         15.1.0  h767d61c_3          conda-forge
  + libgcc-ng                      15.1.0  h69a702a_3          conda-forge
  + libgomp                        15.1.0  h767d61c_3          conda-forge
  + libiconv                         1.18  h4ce23a2_1          conda-forge
  + liblzma                         5.8.1  hb9d3cd8_2          conda-forge
  + libmamba                        2.1.1  h430c389_0          conda-forge
  + libmambapy                      2.1.1  py312h07448e0_0     conda-forge
  + libnghttp2                     1.64.0  h161d5f1_0          conda-forge
  + libnsl                          2.0.1  hb9d3cd8_1          conda-forge
  + libsolv                        0.7.34  h9463b59_0          conda-forge
  + libsqlite                      3.50.3  hee844dc_1          conda-forge
  + libssh2                        1.11.1  hcf80075_0          conda-forge
  + libstdcxx                      15.1.0  h8f9b012_3          conda-forge
  + libstdcxx-ng                   15.1.0  h4852527_3          conda-forge
  + libuuid                        2.38.1  h0b41bf4_0          conda-forge
  + libxcrypt                      4.4.36  hd590300_1          conda-forge
  + libxml2                        2.13.8  h4bc477f_0          conda-forge
  + libzlib                         1.3.1  hb9d3cd8_2          conda-forge
  + lz4-c                          1.10.0  h5888daf_1          conda-forge
  + lzo                              2.10  hd590300_1001       conda-forge
  + mamba                           2.1.1  had4a41a_0          conda-forge
  + menuinst                        2.3.1  py312h7900ff3_0     conda-forge
  + ncurses                           6.5  h2d0b736_3          conda-forge
  + nlohmann_json                  3.11.3  he02047a_1          conda-forge
  + openssl                         3.5.1  h7b32b05_0          conda-forge
  + packaging                        25.0  pyh29332c3_1        conda-forge
  + pip                            25.1.1  pyh8b19718_0        conda-forge
  + platformdirs                    4.3.8  pyhe01879c_0        conda-forge
  + pluggy                          1.6.0  pyhd8ed1ab_0        conda-forge
  + pybind11-abi                        4  hd8ed1ab_3          conda-forge
  + pycosat                         0.6.6  py312h66e93f0_2     conda-forge
  + pycparser                        2.22  pyh29332c3_1        conda-forge
  + pysocks                         1.7.1  pyha55dd90_7        conda-forge
  + python                        3.12.11  h9e4cc4f_0_cpython  conda-forge
  + python_abi                       3.12  8_cp312             conda-forge
  + readline                          8.2  h8c095d6_2          conda-forge
  + reproc                   14.2.5.post0  hb9d3cd8_0          conda-forge
  + reproc-cpp               14.2.5.post0  h5888daf_0          conda-forge
  + requests                       2.32.4  pyhd8ed1ab_0        conda-forge
  + ruamel.yaml                   0.18.14  py312h66e93f0_0     conda-forge
  + ruamel.yaml.clib                0.2.8  py312h66e93f0_1     conda-forge
  + setuptools                     80.9.0  pyhff2d567_0        conda-forge
  + simdjson                       3.12.3  h84d6215_0          conda-forge
  + tk                             8.6.13  noxft_hd72426e_102  conda-forge
  + tqdm                           4.67.1  pyhd8ed1ab_1        conda-forge
  + truststore                     0.10.1  pyh29332c3_0        conda-forge
  + tzdata                          2025b  h78e105d_0          conda-forge
  + urllib3                         2.5.0  pyhd8ed1ab_0        conda-forge
  + wheel                          0.45.1  pyhd8ed1ab_1        conda-forge
  + yaml-cpp                        0.8.0  h3f2d84a_0          conda-forge
  + zstandard                      0.23.0  py312h66e93f0_2     conda-forge
  + zstd                            1.5.7  hb8e6e7a_2          conda-forge

  Summary:

  Install: 88 packages

  Total download: 0 B

─────────────────────────────────────────────────────────────────────────────────────



Transaction starting
Linking _libgcc_mutex-0.1-conda_forge
Linking ca-certificates-2025.7.14-hbd8a1cb_0
Linking ld_impl_linux-64-2.44-h1423503_1
Linking libgomp-15.1.0-h767d61c_3
Linking pybind11-abi-4-hd8ed1ab_3
Linking python_abi-3.12-8_cp312
Linking tzdata-2025b-h78e105d_0
Linking _openmp_mutex-4.5-2_gnu
Linking libgcc-15.1.0-h767d61c_3
Linking c-ares-1.34.5-hb9d3cd8_0
Linking libexpat-2.7.1-hecca717_0
Linking libffi-3.4.6-h2dba641_1
Linking libgcc-ng-15.1.0-h69a702a_3
Linking libiconv-1.18-h4ce23a2_1
Linking liblzma-5.8.1-hb9d3cd8_2
Linking libnsl-2.0.1-hb9d3cd8_1
Linking libstdcxx-15.1.0-h8f9b012_3
Linking libzlib-1.3.1-hb9d3cd8_2
Linking ncurses-6.5-h2d0b736_3
Linking openssl-3.5.1-h7b32b05_0
Linking reproc-14.2.5.post0-hb9d3cd8_0
Linking bzip2-1.0.8-h4bc722e_7
Linking cpp-expected-1.1.0-hff21bea_1
Linking fmt-11.1.4-h07f6e7f_1
Linking keyutils-1.6.1-h166bdaf_0
Linking libedit-3.1.20250104-pl5321h7949ede_0
Linking libev-4.33-hd590300_2
Linking libsolv-0.7.34-h9463b59_0
Linking libssh2-1.11.1-hcf80075_0
Linking libstdcxx-ng-15.1.0-h4852527_3
Linking libuuid-2.38.1-h0b41bf4_0
Linking libxcrypt-4.4.36-hd590300_1
Linking lz4-c-1.10.0-h5888daf_1
Linking lzo-2.10-hd590300_1001
Linking readline-8.2-h8c095d6_2
Linking reproc-cpp-14.2.5.post0-h5888daf_0
Linking simdjson-3.12.3-h84d6215_0
Linking tk-8.6.13-noxft_hd72426e_102
Linking yaml-cpp-0.8.0-h3f2d84a_0
Linking zstd-1.5.7-hb8e6e7a_2
Linking icu-75.1-he02047a_0
Linking krb5-1.21.3-h659f571_0
Linking libnghttp2-1.64.0-h161d5f1_0
Linking nlohmann_json-3.11.3-he02047a_1
Linking libcurl-8.14.1-h332b0f4_0
Linking libsqlite-3.50.3-hee844dc_1
Linking libxml2-2.13.8-h4bc477f_0
Linking libarchive-3.7.7-h75ea233_4
Linking python-3.12.11-h9e4cc4f_0_cpython
Linking libmamba-2.1.1-h430c389_0
Linking menuinst-2.3.1-py312h7900ff3_0
Linking archspec-0.2.5-pyhd8ed1ab_0
Linking boltons-25.0.0-pyhd8ed1ab_0
Linking brotli-python-1.1.0-py312h2ec8cdc_3
Linking certifi-2025.7.14-pyhd8ed1ab_0
Linking charset-normalizer-3.4.2-pyhd8ed1ab_0
Linking colorama-0.4.6-pyhd8ed1ab_1
Linking distro-1.9.0-pyhd8ed1ab_1
Linking frozendict-2.4.6-py312h66e93f0_0
Linking hpack-4.1.0-pyhd8ed1ab_0
Linking hyperframe-6.1.0-pyhd8ed1ab_0
Linking idna-3.10-pyhd8ed1ab_1
Linking jsonpointer-3.0.0-py312h7900ff3_1
Linking libmambapy-2.1.1-py312h07448e0_0
Linking mamba-2.1.1-had4a41a_0
Linking packaging-25.0-pyh29332c3_1
Linking platformdirs-4.3.8-pyhe01879c_0
Linking pluggy-1.6.0-pyhd8ed1ab_0
Linking pycosat-0.6.6-py312h66e93f0_2
Linking pycparser-2.22-pyh29332c3_1
Linking pysocks-1.7.1-pyha55dd90_7
Linking ruamel.yaml.clib-0.2.8-py312h66e93f0_1
Linking setuptools-80.9.0-pyhff2d567_0
Linking truststore-0.10.1-pyh29332c3_0
Linking wheel-0.45.1-pyhd8ed1ab_1
Linking cffi-1.17.1-py312h06ac9bb_0
Linking h2-4.2.0-pyhd8ed1ab_0
Linking jsonpatch-1.33-pyhd8ed1ab_1
Linking pip-25.1.1-pyh8b19718_0
Linking ruamel.yaml-0.18.14-py312h66e93f0_0
Linking tqdm-4.67.1-pyhd8ed1ab_1
Linking zstandard-0.23.0-py312h66e93f0_2
Linking conda-package-streaming-0.12.0-pyhd8ed1ab_0
Linking urllib3-2.5.0-pyhd8ed1ab_0
Linking requests-2.32.4-pyhd8ed1ab_0
Linking conda-package-handling-2.4.0-pyh7900ff3_2
Linking conda-25.3.1-py312h7900ff3_1
Linking conda-libmamba-solver-25.3.0-pyhd8ed1ab_0

Transaction finished

installation finished.
[root@localhost ~]#

可以看到安装完成了!

2.4 查看可执行文件信息

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
[root@localhost ~]# /srv/miniforge/bin/conda -V
conda 25.3.1
[root@localhost ~]# /srv/miniforge/bin/python -V
Python 3.12.11
[root@localhost ~]# ls -lah /srv/miniforge/bin/python*
lrwxrwxrwx 1 root root   10 Oct 25 20:55 /srv/miniforge/bin/python -> python3.12
lrwxrwxrwx 1 root root   10 Oct 25 20:55 /srv/miniforge/bin/python3 -> python3.12
lrwxrwxrwx 1 root root   10 Oct 25 20:55 /srv/miniforge/bin/python3.1 -> python3.12
-rwxrwxr-x 1 root root  30M Oct 25 20:55 /srv/miniforge/bin/python3.12
-rwxrwxr-x 1 root root 3.4K Oct 25 20:55 /srv/miniforge/bin/python3.12-config
lrwxrwxrwx 1 root root   17 Oct 25 20:55 /srv/miniforge/bin/python3-config -> python3.12-config
[root@localhost ~]#

至此安全的高版本Python 3.12.11安装成功了!conda版本是25.3.1.

2.5 查看配置代理是否生效

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[root@localhost ~]# /srv/miniforge/bin/conda config --show-sources
==> /srv/miniforge/.condarc <==
channels:
  - conda-forge

==> /root/.condarc <==
channels:
  - defaults
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/
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
show_channel_urls: True

[root@localhost ~]# cat /srv/miniforge/.condarc
channels:
  - conda-forge
[root@localhost ~]#

可以看到,当前有两个配置,一个是默认的/srv/miniforge/.condarc,一个是我手动创建的/root/.condarc,为了让我们自己的配置文件生效,将默认的配置文件重命名一下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## 修改默认配置文件名
[root@localhost ~]# mv /srv/miniforge/.condarc /srv/miniforge/.condarc.bak

## 再次查看配置信息,可以看到当前只我设置的请华大学代理
[root@localhost ~]# /srv/miniforge/bin/conda config --show-sources
==> /root/.condarc <==
channels:
  - defaults
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/
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
show_channel_urls: True

[root@localhost ~]#

2.6 查看当前虚拟环境

1
2
3
4
5
6
7
[root@localhost ~]# /srv/miniforge/bin/conda env list

## conda environments:
##
base                   /srv/miniforge

[root@localhost ~]#

此时可以看到,只有默认的base环境,这个是安装miniforge自动生成的!

2.7 查看当前conda环境可用的Python版本

查看当前conda环境可用的Python版本,使用以下命令:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
[root@localhost ~]# /srv/miniforge/bin/conda search python
Loading channels: done
## Name                       Version           Build  Channel
python                        2.7.13     hac47a24_15  anaconda/pkgs/main
python                        2.7.13     heccc3f1_16  anaconda/pkgs/main
python                        2.7.13     hfff3488_13  anaconda/pkgs/main
python                        2.7.14     h1571d57_29  anaconda/pkgs/main
python                        2.7.14     h1571d57_30  anaconda/pkgs/main
python                        2.7.14     h1571d57_31  anaconda/pkgs/main
python                        2.7.14     h1aa7481_19  anaconda/pkgs/main
python                        2.7.14     h435b27a_18  anaconda/pkgs/main
python                        2.7.14     h89e7a4a_22  anaconda/pkgs/main
python                        2.7.14     h91f54f5_26  anaconda/pkgs/main
python                        2.7.14     h931c8b0_15  anaconda/pkgs/main
python                        2.7.14     h9b67528_20  anaconda/pkgs/main
python                        2.7.14     ha6fc286_23  anaconda/pkgs/main
python                        2.7.14     hc2b0042_21  anaconda/pkgs/main
python                        2.7.14     hdd48546_24  anaconda/pkgs/main
python                        2.7.14     hf918d8d_16  anaconda/pkgs/main
python                        2.7.15      h1571d57_0  anaconda/pkgs/main
python                        2.7.15      h77bded6_1  anaconda/pkgs/main
python                        2.7.15      h77bded6_2  anaconda/pkgs/main
python                        2.7.15      h9bab390_2  anaconda/pkgs/main
python                        2.7.15      h9bab390_4  anaconda/pkgs/main
python                        2.7.15      h9bab390_6  anaconda/pkgs/main
python                        2.7.16      h8b3fad2_1  anaconda/pkgs/main
python                        2.7.16      h8b3fad2_2  anaconda/pkgs/main
python                        2.7.16      h8b3fad2_3  anaconda/pkgs/main
python                        2.7.16      h8b3fad2_4  anaconda/pkgs/main
python                        2.7.16      h8b3fad2_5  anaconda/pkgs/main
python                        2.7.16      h9bab390_0  anaconda/pkgs/main
python                        2.7.16      h9bab390_6  anaconda/pkgs/main
python                        2.7.16      h9bab390_7  anaconda/pkgs/main
python                        2.7.17      h9bab390_0  anaconda/pkgs/main
python                        2.7.18      h02575d3_0  anaconda/pkgs/main
python                        2.7.18      h15b4118_1  anaconda/pkgs/main
python                        2.7.18      h42bf7aa_3  anaconda/pkgs/main
python                        2.7.18      ha1903f6_2  anaconda/pkgs/main
python                         3.5.4     h00c01ad_19  anaconda/pkgs/main
python                         3.5.4     h0b4c808_22  anaconda/pkgs/main
python                         3.5.4     h2170f06_12  anaconda/pkgs/main
python                         3.5.4     h3075507_18  anaconda/pkgs/main
python                         3.5.4     h417fded_24  anaconda/pkgs/main
python                         3.5.4     h56e0582_23  anaconda/pkgs/main
python                         3.5.4     h72f0b78_15  anaconda/pkgs/main
python                         3.5.4     hb43c6bb_21  anaconda/pkgs/main
python                         3.5.4     hc053d89_14  anaconda/pkgs/main
python                         3.5.4     hc3d631a_27  anaconda/pkgs/main
python                         3.5.4     he2c66cf_20  anaconda/pkgs/main
python                         3.5.5      hc3d631a_0  anaconda/pkgs/main
python                         3.5.5      hc3d631a_1  anaconda/pkgs/main
python                         3.5.5      hc3d631a_3  anaconda/pkgs/main
python                         3.5.5      hc3d631a_4  anaconda/pkgs/main
python                         3.5.6      h12debd9_1  anaconda/pkgs/main
python                         3.5.6      hc3d631a_0  anaconda/pkgs/main
python                         3.6.2     h02fb82a_12  anaconda/pkgs/main
python                         3.6.2     h0b30769_14  anaconda/pkgs/main
python                         3.6.2     h33255ae_18  anaconda/pkgs/main
python                         3.6.2     hca45abc_19  anaconda/pkgs/main
python                         3.6.2     hdfe5801_15  anaconda/pkgs/main
python                         3.6.3      h0ef2715_3  anaconda/pkgs/main
python                         3.6.3      h1284df2_4  anaconda/pkgs/main
python                         3.6.3      h6c0c0dc_5  anaconda/pkgs/main
python                         3.6.3      hc9025b9_1  anaconda/pkgs/main
python                         3.6.3      hcad60d5_0  anaconda/pkgs/main
python                         3.6.3      hefd0734_2  anaconda/pkgs/main
python                         3.6.4      hc3d631a_0  anaconda/pkgs/main
python                         3.6.4      hc3d631a_1  anaconda/pkgs/main
python                         3.6.4      hc3d631a_3  anaconda/pkgs/main
python                         3.6.5      hc3d631a_0  anaconda/pkgs/main
python                         3.6.5      hc3d631a_1  anaconda/pkgs/main
python                         3.6.5      hc3d631a_2  anaconda/pkgs/main
python                         3.6.6      h6e4f718_2  anaconda/pkgs/main
python                         3.6.6      hc3d631a_0  anaconda/pkgs/main
python                         3.6.7      h0371630_0  anaconda/pkgs/main
python                         3.6.8      h0371630_0  anaconda/pkgs/main
python                         3.6.9      h265db76_0  anaconda/pkgs/main
python                        3.6.10      h0371630_0  anaconda/pkgs/main
python                        3.6.10      h191fe78_1  anaconda/pkgs/main
python                        3.6.10      h7579374_2  anaconda/pkgs/main
python                        3.6.10      hcf32534_1  anaconda/pkgs/main
python                        3.6.12      hcff3b4d_2  anaconda/pkgs/main
python                        3.6.13      h12debd9_1  anaconda/pkgs/main
python                        3.6.13      hdb3f193_0  anaconda/pkgs/main
python                         3.7.0      h6e4f718_3  anaconda/pkgs/main
python                         3.7.0      hc3d631a_0  anaconda/pkgs/main
python                         3.7.1      h0371630_3  anaconda/pkgs/main
python                         3.7.1      h0371630_7  anaconda/pkgs/main
python                         3.7.2      h0371630_0  anaconda/pkgs/main
python                         3.7.3      h0371630_0  anaconda/pkgs/main
python                         3.7.4      h265db76_0  anaconda/pkgs/main
python                         3.7.4      h265db76_1  anaconda/pkgs/main
python                         3.7.5      h0371630_0  anaconda/pkgs/main
python                         3.7.6      h0371630_2  anaconda/pkgs/main
python                         3.7.7 h191fe78_0_cpython  anaconda/pkgs/main
python                         3.7.7 hcf32534_0_cpython  anaconda/pkgs/main
python                         3.7.7      hcff3b4d_4  anaconda/pkgs/main
python                         3.7.7      hcff3b4d_5  anaconda/pkgs/main
python                         3.7.9      h7579374_0  anaconda/pkgs/main
python                        3.7.10      h12debd9_4  anaconda/pkgs/main
python                        3.7.10      hdb3f193_0  anaconda/pkgs/main
python                        3.7.11      h12debd9_0  anaconda/pkgs/main
python                        3.7.13      h12debd9_0  anaconda/pkgs/main
python                        3.7.13      haa1d7c7_1  anaconda/pkgs/main
python                        3.7.15      h7a1cb2a_1  anaconda/pkgs/main
python                        3.7.15      haa1d7c7_0  anaconda/pkgs/main
python                        3.7.16      h7a1cb2a_0  anaconda/pkgs/main
python                         3.8.0      h0371630_0  anaconda/pkgs/main
python                         3.8.0      h0371630_1  anaconda/pkgs/main
python                         3.8.0      h0371630_2  anaconda/pkgs/main
python                         3.8.1      h0371630_1  anaconda/pkgs/main
python                         3.8.2      h191fe78_0  anaconda/pkgs/main
python                         3.8.2      hcf32534_0  anaconda/pkgs/main
python                         3.8.2     hcff3b4d_13  anaconda/pkgs/main
python                         3.8.2     hcff3b4d_14  anaconda/pkgs/main
python                         3.8.3      hcff3b4d_0  anaconda/pkgs/main
python                         3.8.3      hcff3b4d_2  anaconda/pkgs/main
python                         3.8.5      h7579374_1  anaconda/pkgs/main
python                         3.8.5      hcff3b4d_0  anaconda/pkgs/main
python                         3.8.8      hdb3f193_4  anaconda/pkgs/main
python                         3.8.8      hdb3f193_5  anaconda/pkgs/main
python                        3.8.10      h12debd9_8  anaconda/pkgs/main
python                        3.8.10      hdb3f193_7  anaconda/pkgs/main
python                        3.8.11 h12debd9_0_cpython  anaconda/pkgs/main
python                        3.8.12      h12debd9_0  anaconda/pkgs/main
python                        3.8.13      h12debd9_0  anaconda/pkgs/main
python                        3.8.13      haa1d7c7_1  anaconda/pkgs/main
python                        3.8.15      h3fd9d12_0  anaconda/pkgs/main
python                        3.8.15      h7a1cb2a_2  anaconda/pkgs/main
python                        3.8.16      h7a1cb2a_2  anaconda/pkgs/main
python                        3.8.16      h7a1cb2a_3  anaconda/pkgs/main
python                        3.8.16      h955ad1f_4  anaconda/pkgs/main
python                        3.8.17      h7a1cb2a_0  anaconda/pkgs/main
python                        3.8.17      h955ad1f_0  anaconda/pkgs/main
python                        3.8.18      h7a1cb2a_0  anaconda/pkgs/main
python                        3.8.18      h955ad1f_0  anaconda/pkgs/main
python                        3.8.19      h955ad1f_0  anaconda/pkgs/main
python                        3.8.20      he870216_0  anaconda/pkgs/main
python                         3.9.0      hcff3b4d_1  anaconda/pkgs/main
python                         3.9.0      hdb3f193_2  anaconda/pkgs/main
python                         3.9.1      hdb3f193_2  anaconda/pkgs/main
python                         3.9.2      hdb3f193_0  anaconda/pkgs/main
python                         3.9.4      hdb3f193_0  anaconda/pkgs/main
python                         3.9.5      h12debd9_4  anaconda/pkgs/main
python                         3.9.5      hdb3f193_3  anaconda/pkgs/main
python                         3.9.6      h12debd9_0  anaconda/pkgs/main
python                         3.9.6      h12debd9_1  anaconda/pkgs/main
python                         3.9.7      h12debd9_1  anaconda/pkgs/main
python                        3.9.11      h12debd9_1  anaconda/pkgs/main
python                        3.9.11      h12debd9_2  anaconda/pkgs/main
python                        3.9.12      h12debd9_0  anaconda/pkgs/main
python                        3.9.12      h12debd9_1  anaconda/pkgs/main
python                        3.9.13      haa1d7c7_1  anaconda/pkgs/main
python                        3.9.13      haa1d7c7_2  anaconda/pkgs/main
python                        3.9.15      h7a1cb2a_2  anaconda/pkgs/main
python                        3.9.15      haa1d7c7_0  anaconda/pkgs/main
python                        3.9.16      h7a1cb2a_0  anaconda/pkgs/main
python                        3.9.16      h7a1cb2a_1  anaconda/pkgs/main
python                        3.9.16      h7a1cb2a_2  anaconda/pkgs/main
python                        3.9.16      h955ad1f_3  anaconda/pkgs/main
python                        3.9.17      h7a1cb2a_0  anaconda/pkgs/main
python                        3.9.17      h955ad1f_0  anaconda/pkgs/main
python                        3.9.18      h7a1cb2a_0  anaconda/pkgs/main
python                        3.9.18      h955ad1f_0  anaconda/pkgs/main
python                        3.9.19      h955ad1f_0  anaconda/pkgs/main
python                        3.9.19      h955ad1f_1  anaconda/pkgs/main
python                        3.9.20      he870216_1  anaconda/pkgs/main
python                        3.9.21      he870216_1  anaconda/pkgs/main
python                        3.9.23      he99959a_0  anaconda/pkgs/main
python                        3.9.24      h0dcde21_1  anaconda/pkgs/main
python                        3.9.24      h602e5db_0  anaconda/pkgs/main
python                        3.10.0      h12debd9_0  anaconda/pkgs/main
python                        3.10.0      h12debd9_1  anaconda/pkgs/main
python                        3.10.0      h12debd9_2  anaconda/pkgs/main
python                        3.10.0      h12debd9_4  anaconda/pkgs/main
python                        3.10.0      h12debd9_5  anaconda/pkgs/main
python                        3.10.0      h151d27f_3  anaconda/pkgs/main
python                        3.10.3      h12debd9_5  anaconda/pkgs/main
python                        3.10.4      h12debd9_0  anaconda/pkgs/main
python                        3.10.6      haa1d7c7_0  anaconda/pkgs/main
python                        3.10.6      haa1d7c7_1  anaconda/pkgs/main
python                        3.10.8      h7a1cb2a_1  anaconda/pkgs/main
python                        3.10.8      haa1d7c7_0  anaconda/pkgs/main
python                        3.10.9      h7a1cb2a_0  anaconda/pkgs/main
python                        3.10.9      h7a1cb2a_1  anaconda/pkgs/main
python                        3.10.9      h7a1cb2a_2  anaconda/pkgs/main
python                       3.10.10      h7a1cb2a_2  anaconda/pkgs/main
python                       3.10.11      h7a1cb2a_2  anaconda/pkgs/main
python                       3.10.11      h955ad1f_3  anaconda/pkgs/main
python                       3.10.12      h7a1cb2a_0  anaconda/pkgs/main
python                       3.10.12      h955ad1f_0  anaconda/pkgs/main
python                       3.10.13      h7a1cb2a_0  anaconda/pkgs/main
python                       3.10.13      h955ad1f_0  anaconda/pkgs/main
python                       3.10.14      h955ad1f_0  anaconda/pkgs/main
python                       3.10.14      h955ad1f_1  anaconda/pkgs/main
python                       3.10.15      he870216_1  anaconda/pkgs/main
python                       3.10.16      he870216_1  anaconda/pkgs/main
python                       3.10.18      h1a3bd86_0  anaconda/pkgs/main
python                       3.10.19      h6fa692b_0  anaconda/pkgs/main
python                        3.11.0      h7a1cb2a_2  anaconda/pkgs/main
python                        3.11.0      h7a1cb2a_3  anaconda/pkgs/main
python                        3.11.2      h7a1cb2a_0  anaconda/pkgs/main
python                        3.11.3      h7a1cb2a_0  anaconda/pkgs/main
python                        3.11.3      h955ad1f_1  anaconda/pkgs/main
python                        3.11.4      h7a1cb2a_0  anaconda/pkgs/main
python                        3.11.4      h955ad1f_0  anaconda/pkgs/main
python                        3.11.5      h7a1cb2a_0  anaconda/pkgs/main
python                        3.11.5      h955ad1f_0  anaconda/pkgs/main
python                        3.11.7      h955ad1f_0  anaconda/pkgs/main
python                        3.11.8      h955ad1f_0  anaconda/pkgs/main
python                        3.11.9      h955ad1f_0  anaconda/pkgs/main
python                       3.11.10      he870216_0  anaconda/pkgs/main
python                       3.11.11      he870216_0  anaconda/pkgs/main
python                       3.11.13      h1a3bd86_0  anaconda/pkgs/main
python                       3.11.14      h6fa692b_0  anaconda/pkgs/main
python                        3.12.0      h996f2a0_0  anaconda/pkgs/main
python                        3.12.1      h996f2a0_0  anaconda/pkgs/main
python                        3.12.2      h996f2a0_0  anaconda/pkgs/main
python                        3.12.3      h996f2a0_0  anaconda/pkgs/main
python                        3.12.3      h996f2a0_1  anaconda/pkgs/main
python                        3.12.4      h5148396_1  anaconda/pkgs/main
python                        3.12.5      h5148396_1  anaconda/pkgs/main
python                        3.12.6      h5148396_1  anaconda/pkgs/main
python                        3.12.7      h5148396_0  anaconda/pkgs/main
python                        3.12.8      h5148396_0  anaconda/pkgs/main
python                        3.12.9      h5148396_0  anaconda/pkgs/main
python                       3.12.11      h22baa00_0  anaconda/pkgs/main
python                       3.12.12      hc23ea64_0  anaconda/pkgs/main
python                       3.12.12      hd17a9e1_1  anaconda/pkgs/main
python                        3.13.0 hf623796_100_cp313  anaconda/pkgs/main
python                        3.13.1 hf623796_100_cp313  anaconda/pkgs/main
python                        3.13.2 hf623796_100_cp313  anaconda/pkgs/main
python                        3.13.3 h4612cfd_100_cp313  anaconda/pkgs/main
python                        3.13.4 h4612cfd_100_cp313  anaconda/pkgs/main
python                        3.13.5 h4612cfd_100_cp313  anaconda/pkgs/main
python                        3.13.7 h7e8bc2b_100_cp313  anaconda/pkgs/main
python                        3.13.9 h7e8bc2b_100_cp313  anaconda/pkgs/main
python                        3.14.0 h3fc5862_100_cp314  anaconda/pkgs/main
python                        3.14.0 h3fc5862_101_cp314  anaconda/pkgs/main
python                        3.14.0 h89a963b_0_cp314t  anaconda/pkgs/main
python                        3.14.0 h89a963b_1_cp314t  anaconda/pkgs/main
[root@localhost ~]#

可以看到,可以使用的python版本非常多!

2.8 查看已经安装的Python版本

1
2
3
4
5
6
7
8
[root@localhost ~]# /srv/miniforge/bin/conda list python
## packages in environment at /srv/miniforge:
##
## Name                    Version                   Build  Channel
brotli-python             1.1.0           py312h2ec8cdc_3    conda-forge
python                    3.12.11         h9e4cc4f_0_cpython    conda-forge
python_abi                3.12                    8_cp312    conda-forge
[root@localhost ~]#

3. 创建虚拟环境

3.1 创建虚拟环境

使用/srv/miniforge/bin/conda create创建虚拟环境,比如我们现在要安装一个Python 3.10.16这个版本:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
[root@localhost ~]# /srv/miniforge/bin/conda create --name supervisorpython3.10.16 python=3.10.16
Channels:
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done

### Package Plan ##

  environment location: /srv/miniforge/envs/supervisorpython3.10.16

  added / updated specs:
    - python=3.10.16


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _libgcc_mutex-0.1          |             main           3 KB  defaults
    _openmp_mutex-5.1          |            1_gnu          21 KB  defaults
    bzip2-1.0.8                |       h5eee18b_6         262 KB  defaults
    ca-certificates-2025.9.9   |       h06a4308_0         127 KB  defaults
    ld_impl_linux-64-2.40      |       h12ee557_0         710 KB  defaults
    libffi-3.4.4               |       h6a678d5_1         141 KB  defaults
    libgcc-ng-11.2.0           |       h1234567_1         5.3 MB  defaults
    libgomp-11.2.0             |       h1234567_1         474 KB  defaults
    libstdcxx-ng-11.2.0        |       h1234567_1         4.7 MB  defaults
    libuuid-1.41.5             |       h5eee18b_0          27 KB  defaults
    libxcb-1.17.0              |       h9b100fa_0         430 KB  defaults
    libzlib-1.3.1              |       hb25bd0a_0          59 KB  defaults
    ncurses-6.5                |       h7934f7d_0         1.1 MB  defaults
    openssl-3.0.17             |       h5eee18b_0         5.2 MB  defaults
    pip-25.2                   |     pyhc872135_1         1.1 MB  defaults
    pthread-stubs-0.3          |       h0ce48e5_1           5 KB  defaults
    python-3.10.16             |       he870216_1        26.9 MB  defaults
    readline-8.3               |       hc2a1206_0         471 KB  defaults
    setuptools-80.9.0          |  py310h06a4308_0         1.4 MB  defaults
    sqlite-3.50.2              |       hb25bd0a_1         1.1 MB  defaults
    tk-8.6.15                  |       h54e0aa7_0         3.4 MB  defaults
    tzdata-2025b               |       h04d1e81_0         116 KB  defaults
    wheel-0.45.1               |  py310h06a4308_0         115 KB  defaults
    xorg-libx11-1.8.12         |       h9b100fa_1         895 KB  defaults
    xorg-libxau-1.0.12         |       h9b100fa_0          13 KB  defaults
    xorg-libxdmcp-1.1.5        |       h9b100fa_0          19 KB  defaults
    xorg-xorgproto-2024.1      |       h5eee18b_1         580 KB  defaults
    xz-5.6.4                   |       h5eee18b_1         567 KB  defaults
    zlib-1.3.1                 |       hb25bd0a_0          96 KB  defaults
    ------------------------------------------------------------
                                           Total:        55.3 MB

The following NEW packages will be INSTALLED:

  _libgcc_mutex      anaconda/pkgs/main/linux-64::_libgcc_mutex-0.1-main
  _openmp_mutex      anaconda/pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu
  bzip2              anaconda/pkgs/main/linux-64::bzip2-1.0.8-h5eee18b_6
  ca-certificates    anaconda/pkgs/main/linux-64::ca-certificates-2025.9.9-h06a4308_0
  ld_impl_linux-64   anaconda/pkgs/main/linux-64::ld_impl_linux-64-2.40-h12ee557_0
  libffi             anaconda/pkgs/main/linux-64::libffi-3.4.4-h6a678d5_1
  libgcc-ng          anaconda/pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1
  libgomp            anaconda/pkgs/main/linux-64::libgomp-11.2.0-h1234567_1
  libstdcxx-ng       anaconda/pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1
  libuuid            anaconda/pkgs/main/linux-64::libuuid-1.41.5-h5eee18b_0
  libxcb             anaconda/pkgs/main/linux-64::libxcb-1.17.0-h9b100fa_0
  libzlib            anaconda/pkgs/main/linux-64::libzlib-1.3.1-hb25bd0a_0
  ncurses            anaconda/pkgs/main/linux-64::ncurses-6.5-h7934f7d_0
  openssl            anaconda/pkgs/main/linux-64::openssl-3.0.17-h5eee18b_0
  pip                anaconda/pkgs/main/noarch::pip-25.2-pyhc872135_1
  pthread-stubs      anaconda/pkgs/main/linux-64::pthread-stubs-0.3-h0ce48e5_1
  python             anaconda/pkgs/main/linux-64::python-3.10.16-he870216_1
  readline           anaconda/pkgs/main/linux-64::readline-8.3-hc2a1206_0
  setuptools         anaconda/pkgs/main/linux-64::setuptools-80.9.0-py310h06a4308_0
  sqlite             anaconda/pkgs/main/linux-64::sqlite-3.50.2-hb25bd0a_1
  tk                 anaconda/pkgs/main/linux-64::tk-8.6.15-h54e0aa7_0
  tzdata             anaconda/pkgs/main/noarch::tzdata-2025b-h04d1e81_0
  wheel              anaconda/pkgs/main/linux-64::wheel-0.45.1-py310h06a4308_0
  xorg-libx11        anaconda/pkgs/main/linux-64::xorg-libx11-1.8.12-h9b100fa_1
  xorg-libxau        anaconda/pkgs/main/linux-64::xorg-libxau-1.0.12-h9b100fa_0
  xorg-libxdmcp      anaconda/pkgs/main/linux-64::xorg-libxdmcp-1.1.5-h9b100fa_0
  xorg-xorgproto     anaconda/pkgs/main/linux-64::xorg-xorgproto-2024.1-h5eee18b_1
  xz                 anaconda/pkgs/main/linux-64::xz-5.6.4-h5eee18b_1
  zlib               anaconda/pkgs/main/linux-64::zlib-1.3.1-hb25bd0a_0


Proceed ([y]/n)? y   # <===========  注意,此处要处理y,表示确认


Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
##
## To activate this environment, use
##
##     $ conda activate supervisorpython3.10.16
##
## To deactivate an active environment, use
##
##     $ conda deactivate

[root@localhost ~]#

此时一个新的虚拟环境就安装好了!

3.2 查看当前虚拟环境

查看当前所有的虚拟环境:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## 查看当前所有的虚拟环境,可以看到已经多了一个 supervisorpython3.10.16 环境了
[root@localhost ~]# /srv/miniforge/bin/conda env list

## conda environments:
##
base                   /srv/miniforge
supervisorpython3.10.16   /srv/miniforge/envs/supervisorpython3.10.16

## 查看新虚拟环境的Python版本和pip版本信息
[root@localhost ~]# /srv/miniforge/envs/supervisorpython3.10.16/bin/python -V
Python 3.10.16
[root@localhost ~]# /srv/miniforge/envs/supervisorpython3.10.16/bin/pip -V
pip 25.2 from /srv/miniforge/envs/supervisorpython3.10.16/lib/python3.10/site-packages/pip (python 3.10)
[root@localhost ~]#

3.3 配置pip代理

创建配置文件夹~/.pip,然后创建配置文件 ~/.pip/pip.conf

1
2
3
[root@localhost ~]# mkdir -p ~/.pip
[root@localhost ~]# touch ~/.pip/pip.conf
[root@localhost ~]#

然后在配置文件 ~/.pip/pip.conf中写入以下内容:

1
2
3
4
5
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn

然后检查配置是否生效:

1
2
3
4
[root@localhost ~]# /srv/miniforge/envs/supervisorpython3.10.16/bin/pip config list
global.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'
install.trusted-host='https://pypi.tuna.tsinghua.edu.cn'
[root@localhost ~]#

可以看到,虚拟环境已经能正常读取到pip代理配置了。

3.4 安装第三方包

注意,如果直接使用conda安装Python第三方包,有可能导致conda将Python版本也给升级了,为了保持Python版本不变,我们仍然使用pip来安装第三方包。如安装supervisor包,则使用以下命令:

1
2
3
4
5
6
7
8
[root@localhost ~]# /srv/miniforge/envs/supervisorpython3.10.16/bin/pip install supervisor==4.3.0
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting supervisor==4.3.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/0e/65/5e726c372da8a5e35022a94388b12252710aad0c2351699c3d76ae8dba78/supervisor-4.3.0-py2.py3-none-any.whl (320 kB)
Installing collected packages: supervisor
Successfully installed supervisor-4.3.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
[root@localhost ~]#

此处指定了supervisor的版本为4.3.0。

3.5 查看虚拟环境中安装的第三方包

1
2
3
[root@localhost ~]# /srv/miniforge/envs/supervisorpython3.10.16/bin/pip freeze
supervisor==4.3.0
[root@localhost ~]#

可以看到虚拟环境能够正常工作了!

Licensed under the GNU General Public License v3.0