当前位置:   article > 正文

conda 配置清华源_conda 清华源

conda 清华源

conda 配置环境变量

Windows 先执行 conda config --set show_channel_urls yes 生成 .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/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
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
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
ssl_verify: false
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

或者直接命令行执行:

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/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes
conda config --set ssl_verify false
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

conda activate 命令无法使用

  1. 配置系统变量。win系统环境变量 path 添加以下路径
C:\ProgramData\Anaconda3
C:\ProgramData\Anaconda3\Scripts
C:\ProgramData\Anaconda3\bin
  • 1
  • 2
  • 3
  1. 配置 power shell
#  管理员模式打开powershell
Set-ExecutionPolicy Unrestricted
# Powershell脚本,系统默认策略是阻止运行。Unrestricted,允许所有脚本执行

# cmd 中
conda init
# 再新打开cmd
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
Anaconda Navigator         界面创建虚拟环境
Anaconda Prompt      执行conda命令
  • 1
  • 2

Pycharm 选择 conda 环境时,配置 conda 可执行文件:

C:\anaconda3\condabin\conda.bat
  • 1

linux系统环境变量配置

#  修改 .bashrc 文件
vi .bashrc
export PATH="/root/anaconda3/bin:$PATH"

# 或者 修改 .bash_profile 文件
vi .bash_profile
PATH=$PATH:/root/anaconda3/bin
export PATH

# 刷新环境变量
source .bashrc
source .bash_profile

# 刷新conda命令
conda init
source activate
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

取消默认base环境

conda config --set auto_activate_base false
  • 1

使用 conda install 安装python/c/c++相关包

conda install -c conda-forge uwsgi

#  -c  指定 channel 为 conda-forge
#  python3.8 以后,没有 libpython3.8.a 静态库。 pip install uwsgi 会gcc编译报错
  • 1
  • 2
  • 3
  • 4
本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/Guff_9hys/article/detail/914342
推荐阅读
相关标签
  

闽ICP备14008679号