Conda 安装
conda安装
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py38_4.12.0-Linux-x86_64.sh && sh Miniconda3-py38_4.12.0-Linux-x86_64.sh
conda换源
cat > ~/.condarc <<EOF
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
EOF
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes
conda config --show channels
conda create -n sjn-judge1 python=3.11
conda config --set ssl_verify false
#WIN10下Powershell无法使用‘conda activate’
#首先需要给PowerShell(管理员运行)更改一下执行策略(默认是Restricted):
set-ExecutionPolicy RemoteSigned
#然后在Powershell中执行:
conda init powershell
#最后重启PowerShell,发现已经可以自动激活环境了。
pip换源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip常用命令
#安装包
pip install Package
pip install -r requirements.txt
#更新包
pip install -U Package
#卸载包
pip uninstall Package
#列出已安装软件
pip list
pip freeze
pip freeze -r requirements.txt
#某个包详细信息
pip show -f Package
#临时使用指定源安装
pip install -i https://mirrors.aliyun.com/pypi/simple/ tensorboard
#升级pip到最新版本
pip install pip -U