Anaconda使用记录
1 安装
windows下,安装完添加环境变量(哦安装时勾选添加环境变量选项就是加这些变量的)
## (记anaconda软件目录为%ANACONDA3%)
%ANACONDA3%\
%ANACONDA3%\Scripts\
%ANACONDA3%\Library\bin\
%ANACONDA3%\Library\usr\bin\
%ANACONDA3%\Library\mingw-w64\bin\
ubuntu下,通过sh安装完后,添加环境变量
PATH = "$PATH:~/anaconda3/bin"
2 基本命令
## 获取信息
conda list # 当前环境和conda关联环境下总体的包,pip list是当前环境的包
conda env list # 查看当前已有环境
## 添加镜像源
conda config --add channels <source_url>
conda config --show channels # 查看已添加的源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.aliyun.com/pypi/simple/
## 创建新环境
conda create -n <env_name> python=x.x
## 启动环境
source activate <env_name> # [Linux]
activate <env_name> # [Windows]
## 在环境中安装/删除包
直接环境中 pip 操作,或者
conda install -n <env_name> <package>
conda remove -n <env_name> <package>
## 关闭环境
source deactivate # [Linux]
deactivate # [Windows]
## 删除环境
conda remove -n <env_name> --all
3 问题记录
缺少swrast等动态链接库(wsl)
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
qt.xkb.compose: failed to create compose table
形如libGL error: MESA-LOADER: failed to open xxx
https://blog.csdn.net/peng_258/article/details/132500323
按照错误提示,将swrast.so软连接到指定的/usr/lib/dri/swrast_dri.so就可。发现在/lib/x86_64-linux-gnu/dri和/usr/lib/x86_64-linux-gnu/dri中都有swrast_dri.so,感觉哪个都行。
随后会遇到下列报错:
libGL error: MESA-LOADER: failed to open swrast: /home/xlucidator-wsl/anaconda3/lib/python3.12/site-packages/PIL/../../../././libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libLLVM-15.so.1) (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
https://blog.csdn.net/quintus0505/article/details/130758022
根据自己的情况,对本地conda中的libstdc++.so进行替换,换成系统的。
环境中开代理时反而无法pip install(windows)
关了才行,估计哪里配置咩同步...