Winse Blog

走走停停都是风景, 熙熙攘攘都向最好, 忙忙碌碌都为明朝, 何畏之.

树莓派4安装Clash

安装Clash

参考:https://mraddict.top/posts/clash-on-rpi/

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
root@ubuntu:~# arch

# 下载上传clash
root@ubuntu:~# mv clash-linux-arm64 /usr/local/bin/

root@ubuntu:~# cd /usr/local/bin/
root@ubuntu:/usr/local/bin# chmod +x clash-linux-arm64 
root@ubuntu:/usr/local/bin# ln -s clash-linux-arm64 clash
root@ubuntu:/usr/local/bin# ls clash*
clash  clash-linux-arm64
root@ubuntu:/usr/local/bin# ls -l clash*
lrwxrwxrwx 1 root root      17 Mar 24 21:43 clash -> clash-linux-arm64
-rwxr-xr-x 1 root root 8978432 Jan 29 18:59 clash-linux-arm64


# 启动一次,会生成配置和下载Country.mmdb文件:
root@ubuntu:/usr/local/bin# clash
INFO[0000] Can't find config, create a initial config file 
INFO[0000] Can't find MMDB, start download              
INFO[0344] Mixed(http+socks) proxy listening at: 127.0.0.1:7890 

# clash-ui
root@ubuntu:/usr/local/bin# cd ~/.config/clash
root@ubuntu:~/.config/clash# git clone --branch gh-pages https://github.com/Dreamacro/clash-dashboard.git    
Cloning into 'clash-dashboard'...
remote: Enumerating objects: 3951, done.
remote: Counting objects: 100% (232/232), done.
remote: Compressing objects: 100% (172/172), done.
remote: Total 3951 (delta 79), reused 189 (delta 56), pack-reused 3719
Receiving objects: 100% (3951/3951), 4.87 MiB | 21.00 KiB/s, done.
Resolving deltas: 100% (2240/2240), done.

配置:

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
## 配置文件:https://github.com/Dreamacro/clash/wiki/Configuration#introduction
## 下载服务提供的订阅地址内容,保存到文件。

root@ubuntu:~/.config/clash# ln -s Clash_1679667989.yaml config.yaml
root@ubuntu:~/.config/clash# vi config.yaml 
  11 mode: rule
  12 log-level: debug
  13 external-ui: clash-dashboard
  14 external-controller: '0.0.0.0:9090'
  

root@ubuntu:~/.config/clash# clash
INFO[0000] Start initial compatible provider 🎬哔哩哔哩      
INFO[0000] Start initial compatible provider ⚓️其他流量     
INFO[0000] Start initial compatible provider ✈️Telegram 
INFO[0000] Start initial compatible provider 🎬Netflix   
INFO[0000] Start initial compatible provider 🍎苹果服务      
INFO[0000] Start initial compatible provider 🎬Youtube   
INFO[0000] Start initial compatible provider 🎬国外媒体      
INFO[0000] Start initial compatible provider 🚀直接连接      
INFO[0000] Start initial compatible provider 🔰国外流量      
INFO[0000] Start initial compatible provider Ⓜ️ 微软服务    
INFO[0000] HTTP proxy listening at: 127.0.0.1:7890      
INFO[0000] RESTful API listening at: [::]:9090          
INFO[0000] SOCKS proxy listening at: 127.0.0.1:7891     
INFO[0000] Redirect proxy listening at: 127.0.0.1:7892 


# 打开 http://192.168.123.41:9090/ui/#/settings 页面后,添加一下服务器的ip地址,就可以访问了。

安装conda

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
# 用代理下载后面的数据
root@ubuntu:~# export http_proxy="http://127.0.0.1:7890"
root@ubuntu:~# export https_proxy="http://127.0.0.1:7890"

root@ubuntu:~# wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh     
--2023-03-24 23:16:35--  https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh
Connecting to 127.0.0.1:7890... connected.
Proxy request sent, awaiting response... 302 Found
Location: https://github.com/conda-forge/miniforge/releases/download/22.11.1-4/Miniforge3-Linux-aarch64.sh [following]
--2023-03-24 23:16:35--  https://github.com/conda-forge/miniforge/releases/download/22.11.1-4/Miniforge3-Linux-aarch64.sh
Reusing existing connection to github.com:443.
Proxy request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/221584272/97169057-ca90-4fce-873e-a7d6d2e1db90?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230324%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230324T151635Z&X-Amz-Expires=300&X-Amz-Signature=c46561816462b1e2bcd82d8b99f8ce840f4ff9b6214fda083828079783d43f0f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=221584272&response-content-disposition=attachment%3B%20filename%3DMiniforge3-Linux-aarch64.sh&response-content-type=application%2Foctet-stream [following]
--2023-03-24 23:16:36--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/221584272/97169057-ca90-4fce-873e-a7d6d2e1db90?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230324%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230324T151635Z&X-Amz-Expires=300&X-Amz-Signature=c46561816462b1e2bcd82d8b99f8ce840f4ff9b6214fda083828079783d43f0f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=221584272&response-content-disposition=attachment%3B%20filename%3DMiniforge3-Linux-aarch64.sh&response-content-type=application%2Foctet-stream
Connecting to 127.0.0.1:7890... connected.
Proxy request sent, awaiting response... 200 OK
Length: 53550114 (51M) [application/octet-stream]
Saving to: ‘Miniforge3-Linux-aarch64.sh.1’

Miniforge3-Linux-aarch64.sh.1                    1%[>                                                                                                  ] 752.00K  9.01KB/s    in 74s     

2023-03-24 23:17:51 (10.2 KB/s) - Connection closed at byte 770048. Retrying.

## 默认用的是direct,没有翻墙。在9090/ui页面先把原来的[连接]停掉,然后把[代理]切换到香港的节点

--2023-03-24 23:17:52--  (try: 2)  https://objects.githubusercontent.com/github-production-release-asset-2e65be/221584272/97169057-ca90-4fce-873e-a7d6d2e1db90?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230324%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230324T151635Z&X-Amz-Expires=300&X-Amz-Signature=c46561816462b1e2bcd82d8b99f8ce840f4ff9b6214fda083828079783d43f0f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=221584272&response-content-disposition=attachment%3B%20filename%3DMiniforge3-Linux-aarch64.sh&response-content-type=application%2Foctet-stream
Connecting to 127.0.0.1:7890... connected.
Proxy request sent, awaiting response... 206 Partial Content
Length: 53550114 (51M), 52780066 (50M) remaining [application/octet-stream]
Saving to: ‘Miniforge3-Linux-aarch64.sh.1’

Miniforge3-Linux-aarch64.sh.1                  100%[+=================================================================================================>]  51.07M  2.79MB/s    in 21s     

2023-03-24 23:18:14 (2.39 MB/s) - ‘Miniforge3-Linux-aarch64.sh.1’ saved [53550114/53550114]

root@ubuntu:~# 

root@ubuntu:~# rm -rf Miniforge3-Linux-aarch64.sh
root@ubuntu:~# mv Miniforge3-Linux-aarch64.sh.1 Miniforge3-Linux-aarch64.sh
root@ubuntu:~# chmod +x Miniforge3-Linux-aarch64.sh

root@ubuntu:~# rm -rf /usr/local/miniforge3
root@ubuntu:~# ./Miniforge3-Linux-aarch64.sh 

Welcome to Miniforge3 22.11.1-4

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>  
Miniforge installer code uses BSD-3-Clause license as stated below.

Binary packages that come with it have their own licensing terms
and by installing miniforge you agree to the licensing terms of individual
packages as well. They include different OSI-approved licenses including
the GNU General Public License and can be found in pkgs/<pkg-name>/info/licenses
folders.

Miniforge installer comes with a boostrapping executable that is used
when installing miniforge and is deleted after miniforge is installed.
The bootstrapping executable uses micromamba, cli11, cpp-filesystem,
curl, c-ares, krb5, libarchive, libev, lz4, nghttp2, openssl, libsolv,
nlohmann-json, reproc and zstd which are licensed under BSD-3-Clause,
MIT and OpenSSL licenses. Licenses and copyright notices of these
projects can be found at the following URL.
https://github.com/conda-forge/micromamba-feedstock/tree/master/recipe.

=============================================================================

Copyright (c) 2019-2022, conda-forge
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Do you accept the license terms? [yes|no]
[no] >>> yes

Miniforge3 will now be installed into this location:
/root/miniforge3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/root/miniforge3] >>> /usr/local/miniforge3   
PREFIX=/usr/local/miniforge3
Unpacking payload ...
Extracting ca-certificates-2022.12.7-h4fd8a4c_0.conda
Extracting ld_impl_linux-aarch64-2.40-h2d8c526_0.conda
Extracting libgomp-12.2.0-h607ecd0_19.tar.bz2
Extracting libstdcxx-ng-12.2.0-hc13a102_19.tar.bz2
Extracting python_abi-3.10-3_cp310.conda
Extracting tzdata-2022g-h191b570_0.conda
Extracting _openmp_mutex-4.5-2_gnu.tar.bz2
Extracting libgcc-ng-12.2.0-h607ecd0_19.tar.bz2
Extracting bzip2-1.0.8-hf897c2e_4.tar.bz2
Extracting libffi-3.4.2-h3557bc0_5.tar.bz2
Extracting libnsl-2.0.0-hf897c2e_0.tar.bz2
Extracting libuuid-2.32.1-hf897c2e_1000.tar.bz2
Extracting libzlib-1.2.13-h4e544f5_4.tar.bz2
Extracting ncurses-6.3-headf329_1.tar.bz2
Extracting openssl-3.0.8-hb4cce97_0.conda
Extracting xz-5.2.6-h9cdd2b7_0.tar.bz2
Extracting libsqlite-3.40.0-hf9034f9_0.tar.bz2
Extracting readline-8.1.2-h38e3740_0.tar.bz2
Extracting tk-8.6.12-hd8af866_0.tar.bz2
Extracting zstd-1.5.2-h44f6412_6.conda
Extracting python-3.10.9-ha43d526_0_cpython.conda
Extracting certifi-2022.12.7-pyhd8ed1ab_0.conda
Extracting charset-normalizer-2.1.1-pyhd8ed1ab_0.tar.bz2
Extracting colorama-0.4.6-pyhd8ed1ab_0.tar.bz2
Extracting idna-3.4-pyhd8ed1ab_0.tar.bz2
Extracting pluggy-1.0.0-pyhd8ed1ab_5.tar.bz2
Extracting pycosat-0.6.4-py310h761cc84_1.tar.bz2
Extracting pycparser-2.21-pyhd8ed1ab_0.tar.bz2
Extracting pysocks-1.7.1-pyha2e5f31_6.tar.bz2
Extracting ruamel.yaml.clib-0.2.7-py310hb89b984_1.conda
Extracting setuptools-65.6.3-pyhd8ed1ab_0.conda
Extracting toolz-0.12.0-pyhd8ed1ab_0.tar.bz2
Extracting wheel-0.38.4-pyhd8ed1ab_0.tar.bz2
Extracting cffi-1.15.1-py310hf0c4615_3.conda
Extracting pip-23.0-pyhd8ed1ab_0.conda
Extracting ruamel.yaml-0.17.21-py310h761cc84_2.tar.bz2
Extracting tqdm-4.64.1-pyhd8ed1ab_0.tar.bz2
Extracting brotlipy-0.7.0-py310h761cc84_1005.tar.bz2
Extracting cryptography-39.0.1-py310he4ba0b1_0.conda
Extracting zstandard-0.19.0-py310hde4b81c_1.conda
Extracting conda-package-streaming-0.7.0-pyhd8ed1ab_1.conda
Extracting pyopenssl-23.0.0-pyhd8ed1ab_0.conda
Extracting conda-package-handling-2.0.2-pyh38be061_0.conda
Extracting urllib3-1.26.14-pyhd8ed1ab_0.conda
Extracting requests-2.28.2-pyhd8ed1ab_0.conda
Extracting conda-22.11.1-py310h4c7bcd0_1.conda

Installing base environment...


                                           __
          __  ______ ___  ____ _____ ___  / /_  ____ _
         / / / / __ `__ \/ __ `/ __ `__ \/ __ \/ __ `/
        / /_/ / / / / / / /_/ / / / / / / /_/ / /_/ /
       / .___/_/ /_/ /_/\__,_/_/ /_/ /_/_.___/\__,_/
      /_/

Transaction

  Prefix: /usr/local/miniforge3

  Updating specs:

   - conda-forge/linux-aarch64::ca-certificates==2022.12.7=h4fd8a4c_0[md5=2450fbcaf65634e0d071e47e2b8487b4]
   - conda-forge/linux-aarch64::ld_impl_linux-aarch64==2.40=h2d8c526_0[md5=16246d69e945d0b1969a6099e7c5d457]
   - conda-forge/linux-aarch64::libgomp==12.2.0=h607ecd0_19[md5=65b9cb876525dcb2e74a90cf02c6762a]
   - conda-forge/linux-aarch64::libstdcxx-ng==12.2.0=hc13a102_19[md5=981741cd4321edd5c504b48f74fe91f2]
   - conda-forge/linux-aarch64::python_abi==3.10=3_cp310[md5=7f4f00b03d3a7c4d4b8b987e5da461a9]
   - conda-forge/noarch::tzdata==2022g=h191b570_0[md5=51fc4fcfb19f5d95ffc8c339db5068e8]
   - conda-forge/linux-aarch64::_openmp_mutex==4.5=2_gnu[md5=6168d71addc746e8f2b8d57dfd2edcea]
   - conda-forge/linux-aarch64::libgcc-ng==12.2.0=h607ecd0_19[md5=8456a29b6d9fc3123ccb9a966b6b2c49]
   - conda-forge/linux-aarch64::bzip2==1.0.8=hf897c2e_4[md5=2d787570a729e273a4e75775ddf3348a]
   - conda-forge/linux-aarch64::libffi==3.4.2=h3557bc0_5[md5=dddd85f4d52121fab0a8b099c5e06501]
   - conda-forge/linux-aarch64::libnsl==2.0.0=hf897c2e_0[md5=36fdbc05c9d9145ece86f5a63c3f352e]
   - conda-forge/linux-aarch64::libuuid==2.32.1=hf897c2e_1000[md5=e038da5ef9095b0d79aac14a311394e7]
   - conda-forge/linux-aarch64::libzlib==1.2.13=h4e544f5_4[md5=88596b6277fe6d39f046983aae6044db]
   - conda-forge/linux-aarch64::ncurses==6.3=headf329_1[md5=486b68148e121bc8bbadc3cefae4c04f]
   - conda-forge/linux-aarch64::openssl==3.0.8=hb4cce97_0[md5=268fe30a14a3f40fe54da04fc053fd2d]
   - conda-forge/linux-aarch64::xz==5.2.6=h9cdd2b7_0[md5=83baad393a31d59c20b63ba4da6592df]
   - conda-forge/linux-aarch64::libsqlite==3.40.0=hf9034f9_0[md5=9afb0d5dbaa403858a660cd0b4a31d29]
   - conda-forge/linux-aarch64::readline==8.1.2=h38e3740_0[md5=3cdbfb7d7b63ae2c2d35bb167d257ecd]
   - conda-forge/linux-aarch64::tk==8.6.12=hd8af866_0[md5=7894e82ff743bd96c76585ddebe28e2a]
   - conda-forge/linux-aarch64::zstd==1.5.2=h44f6412_6[md5=6d0d1cd6d184129eabb96bb220afb5b2]
   - conda-forge/linux-aarch64::python==3.10.9=ha43d526_0_cpython[md5=24478dd738f2d557efe2a4fc6a248eb3]
   - conda-forge/noarch::certifi==2022.12.7=pyhd8ed1ab_0[md5=fb9addc3db06e56abe03e0e9f21a63e6]
   - conda-forge/noarch::charset-normalizer==2.1.1=pyhd8ed1ab_0[md5=c1d5b294fbf9a795dec349a6f4d8be8e]
   - conda-forge/noarch::colorama==0.4.6=pyhd8ed1ab_0[md5=3faab06a954c2a04039983f2c4a50d99]
   - conda-forge/noarch::idna==3.4=pyhd8ed1ab_0[md5=34272b248891bddccc64479f9a7fffed]
   - conda-forge/noarch::pluggy==1.0.0=pyhd8ed1ab_5[md5=7d301a0d25f424d96175f810935f0da9]
   - conda-forge/linux-aarch64::pycosat==0.6.4=py310h761cc84_1[md5=c701cff6d6e7907c93ab603e58082a7c]
   - conda-forge/noarch::pycparser==2.21=pyhd8ed1ab_0[md5=076becd9e05608f8dc72757d5f3a91ff]
   - conda-forge/noarch::pysocks==1.7.1=pyha2e5f31_6[md5=2a7de29fb590ca14b5243c4c812c8025]
   - conda-forge/linux-aarch64::ruamel.yaml.clib==0.2.7=py310hb89b984_1[md5=89972c78c36ed3261c22bde7c012be03]
   - conda-forge/noarch::setuptools==65.6.3=pyhd8ed1ab_0[md5=9600fc9524d3f821e6a6d58c52f5bf5a]
   - conda-forge/noarch::toolz==0.12.0=pyhd8ed1ab_0[md5=92facfec94bc02d6ccf42e7173831a36]
   - conda-forge/noarch::wheel==0.38.4=pyhd8ed1ab_0[md5=c829cfb8cb826acb9de0ac1a2df0a940]
   - conda-forge/linux-aarch64::cffi==1.15.1=py310hf0c4615_3[md5=a2bedcb1d205485ea32fe5d2bd6fd970]
   - conda-forge/noarch::pip==23.0=pyhd8ed1ab_0[md5=85b35999162ec95f9f999bac15279c02]
   - conda-forge/linux-aarch64::ruamel.yaml==0.17.21=py310h761cc84_2[md5=98c0b13f20fcb4f5080554d137e39b37]
   - conda-forge/noarch::tqdm==4.64.1=pyhd8ed1ab_0[md5=5526ff3f88f9db87bb0924b9ce575345]
   - conda-forge/linux-aarch64::brotlipy==0.7.0=py310h761cc84_1005[md5=66934993368d01f896652925d3ac7e66]
   - conda-forge/linux-aarch64::cryptography==39.0.1=py310he4ba0b1_0[md5=3129345d217e5fd6488df794e49e327b]
   - conda-forge/linux-aarch64::zstandard==0.19.0=py310hde4b81c_1[md5=d4b3cc980179c38949c83fe23057d97c]
   - conda-forge/noarch::conda-package-streaming==0.7.0=pyhd8ed1ab_1[md5=1a2fa9e53cfbc2e4d9ab21990805a436]
   - conda-forge/noarch::pyopenssl==23.0.0=pyhd8ed1ab_0[md5=d41957700e83bbb925928764cb7f8878]
   - conda-forge/noarch::conda-package-handling==2.0.2=pyh38be061_0[md5=44800e9bd13143292097c65e57323038]
   - conda-forge/noarch::urllib3==1.26.14=pyhd8ed1ab_0[md5=01f33ad2e0aaf6b5ba4add50dad5ad29]
   - conda-forge/noarch::requests==2.28.2=pyhd8ed1ab_0[md5=11d178fc55199482ee48d6812ea83983]
   - conda-forge/linux-aarch64::conda==22.11.1=py310h4c7bcd0_1[md5=a71c4cc6bd77f61c0c1601b28291c460]


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

  + _openmp_mutex                  4.5  2_gnu               conda-forge     Cached
  + brotlipy                     0.7.0  py310h761cc84_1005  conda-forge     Cached
  + bzip2                        1.0.8  hf897c2e_4          conda-forge     Cached
  + ca-certificates          2022.12.7  h4fd8a4c_0          conda-forge     Cached
  + certifi                  2022.12.7  pyhd8ed1ab_0        conda-forge     Cached
  + cffi                        1.15.1  py310hf0c4615_3     conda-forge     Cached
  + charset-normalizer           2.1.1  pyhd8ed1ab_0        conda-forge     Cached
  + colorama                     0.4.6  pyhd8ed1ab_0        conda-forge     Cached
  + conda                      22.11.1  py310h4c7bcd0_1     conda-forge     Cached
  + conda-package-handling       2.0.2  pyh38be061_0        conda-forge     Cached
  + conda-package-streaming      0.7.0  pyhd8ed1ab_1        conda-forge     Cached
  + cryptography                39.0.1  py310he4ba0b1_0     conda-forge     Cached
  + idna                           3.4  pyhd8ed1ab_0        conda-forge     Cached
  + ld_impl_linux-aarch64         2.40  h2d8c526_0          conda-forge     Cached
  + libffi                       3.4.2  h3557bc0_5          conda-forge     Cached
  + libgcc-ng                   12.2.0  h607ecd0_19         conda-forge     Cached
  + libgomp                     12.2.0  h607ecd0_19         conda-forge     Cached
  + libnsl                       2.0.0  hf897c2e_0          conda-forge     Cached
  + libsqlite                   3.40.0  hf9034f9_0          conda-forge     Cached
  + libstdcxx-ng                12.2.0  hc13a102_19         conda-forge     Cached
  + libuuid                     2.32.1  hf897c2e_1000       conda-forge     Cached
  + libzlib                     1.2.13  h4e544f5_4          conda-forge     Cached
  + ncurses                        6.3  headf329_1          conda-forge     Cached
  + openssl                      3.0.8  hb4cce97_0          conda-forge     Cached
  + pip                           23.0  pyhd8ed1ab_0        conda-forge     Cached
  + pluggy                       1.0.0  pyhd8ed1ab_5        conda-forge     Cached
  + pycosat                      0.6.4  py310h761cc84_1     conda-forge     Cached
  + pycparser                     2.21  pyhd8ed1ab_0        conda-forge     Cached
  + pyopenssl                   23.0.0  pyhd8ed1ab_0        conda-forge     Cached
  + pysocks                      1.7.1  pyha2e5f31_6        conda-forge     Cached
  + python                      3.10.9  ha43d526_0_cpython  conda-forge     Cached
  + python_abi                    3.10  3_cp310             conda-forge     Cached
  + readline                     8.1.2  h38e3740_0          conda-forge     Cached
  + requests                    2.28.2  pyhd8ed1ab_0        conda-forge     Cached
  + ruamel.yaml                0.17.21  py310h761cc84_2     conda-forge     Cached
  + ruamel.yaml.clib             0.2.7  py310hb89b984_1     conda-forge     Cached
  + setuptools                  65.6.3  pyhd8ed1ab_0        conda-forge     Cached
  + tk                          8.6.12  hd8af866_0          conda-forge     Cached
  + toolz                       0.12.0  pyhd8ed1ab_0        conda-forge     Cached
  + tqdm                        4.64.1  pyhd8ed1ab_0        conda-forge     Cached
  + tzdata                       2022g  h191b570_0          conda-forge     Cached
  + urllib3                    1.26.14  pyhd8ed1ab_0        conda-forge     Cached
  + wheel                       0.38.4  pyhd8ed1ab_0        conda-forge     Cached
  + xz                           5.2.6  h9cdd2b7_0          conda-forge     Cached
  + zstandard                   0.19.0  py310hde4b81c_1     conda-forge     Cached
  + zstd                         1.5.2  h44f6412_6          conda-forge     Cached

  Summary:

  Install: 46 packages

  Total download: 0 B

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



Transaction starting
Linking ca-certificates-2022.12.7-h4fd8a4c_0
Linking ld_impl_linux-aarch64-2.40-h2d8c526_0
Linking libgomp-12.2.0-h607ecd0_19
Linking libstdcxx-ng-12.2.0-hc13a102_19
Linking python_abi-3.10-3_cp310
Linking tzdata-2022g-h191b570_0
Linking _openmp_mutex-4.5-2_gnu
Linking libgcc-ng-12.2.0-h607ecd0_19
Linking bzip2-1.0.8-hf897c2e_4
Linking libffi-3.4.2-h3557bc0_5
Linking libnsl-2.0.0-hf897c2e_0
Linking libuuid-2.32.1-hf897c2e_1000
Linking libzlib-1.2.13-h4e544f5_4
Linking ncurses-6.3-headf329_1
Linking openssl-3.0.8-hb4cce97_0
Linking xz-5.2.6-h9cdd2b7_0
Linking libsqlite-3.40.0-hf9034f9_0
Linking readline-8.1.2-h38e3740_0
Linking tk-8.6.12-hd8af866_0
Linking zstd-1.5.2-h44f6412_6
Linking python-3.10.9-ha43d526_0_cpython
Linking certifi-2022.12.7-pyhd8ed1ab_0
Linking charset-normalizer-2.1.1-pyhd8ed1ab_0
Linking colorama-0.4.6-pyhd8ed1ab_0
Linking idna-3.4-pyhd8ed1ab_0
Linking pluggy-1.0.0-pyhd8ed1ab_5
Linking pycosat-0.6.4-py310h761cc84_1
Linking pycparser-2.21-pyhd8ed1ab_0
Linking pysocks-1.7.1-pyha2e5f31_6
Linking ruamel.yaml.clib-0.2.7-py310hb89b984_1
Linking setuptools-65.6.3-pyhd8ed1ab_0
Linking toolz-0.12.0-pyhd8ed1ab_0
Linking wheel-0.38.4-pyhd8ed1ab_0
Linking cffi-1.15.1-py310hf0c4615_3
Linking pip-23.0-pyhd8ed1ab_0
Linking ruamel.yaml-0.17.21-py310h761cc84_2
Linking tqdm-4.64.1-pyhd8ed1ab_0
Linking brotlipy-0.7.0-py310h761cc84_1005
Linking cryptography-39.0.1-py310he4ba0b1_0
Linking zstandard-0.19.0-py310hde4b81c_1
Linking conda-package-streaming-0.7.0-pyhd8ed1ab_1
Linking pyopenssl-23.0.0-pyhd8ed1ab_0
Linking conda-package-handling-2.0.2-pyh38be061_0
Linking urllib3-1.26.14-pyhd8ed1ab_0
Linking requests-2.28.2-pyhd8ed1ab_0
Linking conda-22.11.1-py310h4c7bcd0_1
Transaction finished
installation finished.
Do you wish the installer to initialize Miniforge3
by running conda init? [yes|no]
[no] >>> yes
no change     /usr/local/miniforge3/condabin/conda
no change     /usr/local/miniforge3/bin/conda
no change     /usr/local/miniforge3/bin/conda-env
no change     /usr/local/miniforge3/bin/activate
no change     /usr/local/miniforge3/bin/deactivate
no change     /usr/local/miniforge3/etc/profile.d/conda.sh
no change     /usr/local/miniforge3/etc/fish/conf.d/conda.fish
no change     /usr/local/miniforge3/shell/condabin/Conda.psm1
no change     /usr/local/miniforge3/shell/condabin/conda-hook.ps1
no change     /usr/local/miniforge3/lib/python3.10/site-packages/xontrib/conda.xsh
no change     /usr/local/miniforge3/etc/profile.d/conda.csh
modified      /root/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

If you'd prefer that conda's base environment not be activated on startup, 
   set the auto_activate_base parameter to false: 

conda config --set auto_activate_base false

Thank you for installing Miniforge3!
root@ubuntu:~# 

这里修改了 /root/.bashrc 添加了:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/usr/local/miniforge3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/usr/local/miniforge3/etc/profile.d/conda.sh" ]; then
        . "/usr/local/miniforge3/etc/profile.d/conda.sh"
    else
        export PATH="/usr/local/miniforge3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

为了重新加载环境变量,新开一个窗口,查看版本:

1
2
3
4
5
6
7
8
9
10
11
12
13
(base) root@ubuntu:~# python -V
Python 3.10.9
(base) root@ubuntu:~# 
(base) root@ubuntu:~# conda -V
conda 22.11.1

(base) root@ubuntu:~# python3
Python 3.10.9 | packaged by conda-forge | (main, Feb  2 2023, 20:11:30) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.architecture()
('64bit', 'ELF')
>>> 

使用conda新建一个python3.8的配置 https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

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
(base) root@ubuntu:~# conda info --envs
# conda environments:
#
base                  *  /usr/local/miniforge3

(base) root@ubuntu:~# export http_proxy="http://127.0.0.1:7890"
(base) root@ubuntu:~# export https_proxy="http://127.0.0.1:7890" 

(base) root@ubuntu:~# conda create -n openai python=3.8 
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 22.11.1
  latest version: 23.1.0

Please update conda by running

    $ conda update -n base -c conda-forge conda

Or to minimize the number of packages updated during conda update use

     conda install conda=23.1.0



## Package Plan ##

  environment location: /usr/local/miniforge3/envs/openai

  added / updated specs:
    - python=3.8


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    pypy3.8-7.3.11             |       hf9a8208_0        31.6 MB  conda-forge
    ------------------------------------------------------------
                                           Total:        31.6 MB

The following NEW packages will be INSTALLED:

  _openmp_mutex      conda-forge/linux-aarch64::_openmp_mutex-4.5-2_gnu 
  bzip2              conda-forge/linux-aarch64::bzip2-1.0.8-hf897c2e_4 
  ca-certificates    conda-forge/linux-aarch64::ca-certificates-2022.12.7-h4fd8a4c_0 
  expat              conda-forge/linux-aarch64::expat-2.5.0-ha18d298_0 
  gdbm               conda-forge/linux-aarch64::gdbm-1.18-h0a1914f_2 
  libffi             conda-forge/linux-aarch64::libffi-3.4.2-h3557bc0_5 
  libgcc-ng          conda-forge/linux-aarch64::libgcc-ng-12.2.0-h607ecd0_19 
  libgomp            conda-forge/linux-aarch64::libgomp-12.2.0-h607ecd0_19 
  libsqlite          conda-forge/linux-aarch64::libsqlite-3.40.0-hf9034f9_0 
  libstdcxx-ng       conda-forge/linux-aarch64::libstdcxx-ng-12.2.0-hc13a102_19 
  libzlib            conda-forge/linux-aarch64::libzlib-1.2.13-h4e544f5_4 
  ncurses            conda-forge/linux-aarch64::ncurses-6.3-headf329_1 
  openssl            conda-forge/linux-aarch64::openssl-3.1.0-hb4cce97_0 
  pip                conda-forge/noarch::pip-23.0.1-pyhd8ed1ab_0 
  pypy3.8            conda-forge/linux-aarch64::pypy3.8-7.3.11-hf9a8208_0 
  python             conda-forge/linux-aarch64::python-3.8.16-0_73_pypy 
  python_abi         conda-forge/linux-aarch64::python_abi-3.8-3_pypy38_pp73 
  readline           conda-forge/linux-aarch64::readline-8.2-h8fc344f_1 
  setuptools         conda-forge/noarch::setuptools-67.6.0-pyhd8ed1ab_0 
  sqlite             conda-forge/linux-aarch64::sqlite-3.40.0-h69ca7e5_0 
  tk                 conda-forge/linux-aarch64::tk-8.6.12-hd8af866_0 
  wheel              conda-forge/noarch::wheel-0.40.0-pyhd8ed1ab_0 
  xz                 conda-forge/linux-aarch64::xz-5.2.6-h9cdd2b7_0 
  zlib               conda-forge/linux-aarch64::zlib-1.2.13-h4e544f5_4 


Proceed ([y]/n)? y


Downloading and Extracting Packages
                                                                                                                                                                                          
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate openai
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(base) root@ubuntu:~# 

激活配置:

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
(base) root@ubuntu:~# conda activate openai
(openai) root@ubuntu:~# 
(openai) root@ubuntu:~# python --version
Python 3.8.16 | packaged by conda-forge | (a9dbdca6, Jan 29 2023, 10:19:50)
[PyPy 7.3.11 with GCC 11.3.0]
(openai) root@ubuntu:~# pip --version 
pip 23.0.1 from /usr/local/miniforge3/envs/openai/lib/pypy3.8/site-packages/pip (python 3.8)
(openai) root@ubuntu:~# git clone https://github.com/zhayujie/bot-on-anything
Cloning into 'bot-on-anything'...
remote: Enumerating objects: 644, done.
remote: Counting objects: 100% (271/271), done.
remote: Compressing objects: 100% (116/116), done.
remote: Total 644 (delta 190), reused 194 (delta 154), pack-reused 373
Receiving objects: 100% (644/644), 588.10 KiB | 448.00 KiB/s, done.
Resolving deltas: 100% (373/373), done.
(openai) root@ubuntu:~# 
(openai) root@ubuntu:~# pip3 install itchat-uos==1.5.0.dev0
Collecting itchat-uos==1.5.0.dev0
  Downloading itchat_uos-1.5.0.dev0-py3-none-any.whl (52 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 52.5/52.5 kB 244.0 kB/s eta 0:00:00
Collecting requests
  Downloading requests-2.28.2-py3-none-any.whl (62 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 kB 409.1 kB/s eta 0:00:00
Collecting pyqrcode
  Downloading PyQRCode-1.2.1.zip (41 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.9/41.9 kB 961.5 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting pypng
  Downloading pypng-0.20220715.0-py3-none-any.whl (58 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.1/58.1 kB 540.0 kB/s eta 0:00:00
Collecting charset-normalizer<4,>=2
  Downloading charset_normalizer-3.1.0-py3-none-any.whl (46 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 46.2/46.2 kB 642.4 kB/s eta 0:00:00
Collecting idna<4,>=2.5
  Downloading idna-3.4-py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB 567.0 kB/s eta 0:00:00
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.15-py2.py3-none-any.whl (140 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.9/140.9 kB 1.0 MB/s eta 0:00:00
Collecting certifi>=2017.4.17
  Downloading certifi-2022.12.7-py3-none-any.whl (155 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 155.3/155.3 kB 1.2 MB/s eta 0:00:00
Building wheels for collected packages: pyqrcode
  Building wheel for pyqrcode (setup.py) ... done
  Created wheel for pyqrcode: filename=PyQRCode-1.2.1-py3-none-any.whl size=36228 sha256=ba8cd080e7793f5e55c14fa704e57c1459ae29aa6481c719833bf9e148de5ad0
  Stored in directory: /root/.cache/pip/wheels/5f/46/eb/231c89e0ae989c528db1a30d3aae90c4fee29f14d4e0369312
Successfully built pyqrcode
Installing collected packages: pyqrcode, pypng, urllib3, idna, charset-normalizer, certifi, requests, itchat-uos
Successfully installed certifi-2022.12.7 charset-normalizer-3.1.0 idna-3.4 itchat-uos-1.5.0.dev0 pypng-0.20220715.0 pyqrcode-1.2.1 requests-2.28.2 urllib3-1.26.15
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
(openai) root@ubuntu:~# 
(openai) root@ubuntu:~# pip3 install --upgrade openai
Collecting openai
  Downloading openai-0.27.2-py3-none-any.whl (70 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 70.1/70.1 kB 277.1 kB/s eta 0:00:00
Requirement already satisfied: requests>=2.20 in /usr/local/miniforge3/envs/openai/lib/python3.8/site-packages (from openai) (2.28.2)
Collecting tqdm
  Downloading tqdm-4.65.0-py3-none-any.whl (77 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 77.1/77.1 kB 394.8 kB/s eta 0:00:00
Collecting aiohttp
  Downloading aiohttp-3.8.4.tar.gz (7.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.3/7.3 MB 2.1 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/miniforge3/envs/openai/lib/python3.8/site-packages (from requests>=2.20->openai) (3.1.0)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/miniforge3/envs/openai/lib/python3.8/site-packages (from requests>=2.20->openai) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/miniforge3/envs/openai/lib/python3.8/site-packages (from requests>=2.20->openai) (1.26.15)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/miniforge3/envs/openai/lib/python3.8/site-packages (from requests>=2.20->openai) (2022.12.7)
Collecting attrs>=17.3.0
  Downloading attrs-22.2.0-py3-none-any.whl (60 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.0/60.0 kB 834.6 kB/s eta 0:00:00
Collecting multidict<7.0,>=4.5
  Downloading multidict-6.0.4.tar.gz (51 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 51.3/51.3 kB 1.4 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting async-timeout<5.0,>=4.0.0a3
  Downloading async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting yarl<2.0,>=1.0
  Downloading yarl-1.8.2.tar.gz (172 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 172.3/172.3 kB 1.8 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting frozenlist>=1.1.1
  Downloading frozenlist-1.3.3.tar.gz (66 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.6/66.6 kB 392.4 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting aiosignal>=1.1.2
  Downloading aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Building wheels for collected packages: aiohttp, frozenlist, multidict, yarl
  Building wheel for aiohttp (pyproject.toml) ... done
  Created wheel for aiohttp: filename=aiohttp-3.8.4-py3-none-any.whl size=183495 sha256=6bdf6b07bb86d5e5e452691da3570b0465c4177bec6fbe8ab668aef8d27ce39c
  Stored in directory: /root/.cache/pip/wheels/46/48/fb/1fceb5376aa4eb481cec5ca10d6aece4455cf6a95030009502
  Building wheel for frozenlist (pyproject.toml) ... done
  Created wheel for frozenlist: filename=frozenlist-1.3.3-py3-none-any.whl size=9271 sha256=83ae70b8a9145f1fb94dffca4105ef207500e63dd3d8c056dc63a3f6ba664927
  Stored in directory: /root/.cache/pip/wheels/0e/e7/55/8036a4cd9267238ba8aa2d714837827b8fd836324632469067
  Building wheel for multidict (pyproject.toml) ... done
  Created wheel for multidict: filename=multidict-6.0.4-py3-none-any.whl size=9710 sha256=0a72821685197753e4e43473bbfe1232bb33cd79fa4ad9c97daae3a7e4afd097
  Stored in directory: /root/.cache/pip/wheels/23/65/1f/b5b0672ad49d2ff7b2c6ad75f24f45c407aab185c37803ae76
  Building wheel for yarl (pyproject.toml) ... done
  Created wheel for yarl: filename=yarl-1.8.2-py3-none-any.whl size=24118 sha256=4ed71ce5647e860cac0a0b5496e72e837878a33d62177d3bdded7d20d068b299
  Stored in directory: /root/.cache/pip/wheels/4e/40/2e/3261e7db3f6b66ca3d8a1ec694f2d5d87f89110e2204675597
Successfully built aiohttp frozenlist multidict yarl
Installing collected packages: tqdm, multidict, frozenlist, attrs, async-timeout, yarl, aiosignal, aiohttp, openai
Successfully installed aiohttp-3.8.4 aiosignal-1.3.1 async-timeout-4.0.2 attrs-22.2.0 frozenlist-1.3.3 multidict-6.0.4 openai-0.27.2 tqdm-4.65.0 yarl-1.8.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
(openai) root@ubuntu:~# 

学习conda

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
1
$ eval "$(conda shell.bash activate)"
$ conda shell.bash activate mamba-poc

2
eval "$(conda shell.bash hook)"
conda activate <env-name>

3
#!/bin/bash
source /Users/yourname/anaconda/bin/activate your_env
python --version # example way to see that your virtual env loaded as expected

4
try using

source ~/anaconda3/etc/profile.d/conda.sh

and then do

conda activate pult

5
https://unix.stackexchange.com/questions/689163/launch-terminal-and-conda-activate-env-from-bash-script
# Just activate my conda
alias my_conda='source /home/$USER/anaconda3/bin/activate && conda activate MyPy38'

# Open Jupyter Notebook in my Env
alias my_jupn='source /home/$USER/anaconda3/bin/activate && conda activate MyPy38 && jupyter-notebook'

# Open Jupyter Lab in my Env
alias my_jupl='source /home/$USER/anaconda3/bin/activate && conda activate MyPy38 && jupyter-lab'

# Open Spyder in my Env
alias my_spyder='source /home/$USER/anaconda3/bin/activate && conda activate MyPy38 && spyder'

花生壳

–END

Comments