Conda和Python的国内安装源

Conda和Python的国内安装源

Windows系统:

更换python国内源的方法。
在“C:\Users[xxxx]\pip\pip.ini”文件中配置如下内容(没有则新建,xxx代表当前用户目录):

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com

更换conda的国内源的方法,终端命令输入如下:

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 --set show_channel_urls yes

在windows下可以修改“C:\Users[xxxx].condarc”文件如下内容:
channels:

  • - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
    - defaults
      show_channel_urls: true
      ssl_verify: true

换回默认源:

conda config --remove-key channels

linux系统:

更换python国内源的方法。
在“~/.pip/pip.conf”文件中配置如下内容(没有则新建).执行以下命令

vim  ~/.pip/pip.conf

输入如下内容:

[global]
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com

更换conda的国内源的方法(同Windows系统设置)。
修改apt-get源的方法。
(1)执行如下命令,先备份,再修改“/etc/apt/sources.list”的文件:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
sudo vi /etc/apt/sources.list

(2)复制对应版本的源地址:https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/

ubuntu 14

默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse

ubuntu 16

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

(3)最后执行更新:

sudo apt-get update

Centos的yum源跟换为国内的阿里云源
(1)备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

(2)下载新的CentOS-Base.repo 到/etc/yum.repos.d/

CentOS 5

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

CentOS 6

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3、运行生成缓存

yum makecache

原文地址:https://www.cnblogs.com/aric2016/p/12080013.html

时间: 2024-07-30 21:04:00

Conda和Python的国内安装源的相关文章

python pip 更换国内安装源(windows)

1.点击此电脑,在最上面的的文件夹窗口输入 : %APPDATA% 2.按回车跳转到以下目录,新建pip文件夹 3.创建pip.ini文件 4.打开文件夹,输入以下内容,关闭即可(注意:源镜像可替换) [global] timeout = 6000 index-url = https://pypi.tuna.tsinghua.edu.cn/simple trusted-host = pypi.tuna.tsinghua.edu.cn 5.国内源镜像有: V2EX:http://pypi.v2ex

pip3的国内安装源

1,清华源 pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple virtualen 2,豆瓣源 pip3 install -i https://pypi.douban.com/simple requests 原文地址:https://www.cnblogs.com/kaishirenshi/p/11751342.html

关于已经安装python为何还要安装python-dev

linux发行版通常会把类库的头文件和相关的pkg-config分拆成一个单独的xxx-dev(el)包. 以python为例, 以下情况你是需要python-dev的 你需要自己安装一个源外的python类库, 而这个类库内含需要编译的调用python api的c/c++文件 你自己写的一个程序编译需要链接libpythonXX.(a|so)(注:以上不含使用ctypes/ffi或者裸dlsym方式直接调用libpython.so) 其他正常使用python或者通过安装源内的python类库的

window下python 扩展库安装 使用第三方镜像源

0.前言 由于python的官方镜像位于国外,若使用pip或者easy_install安装第三方插件时或许会被限制,甚至连easy_install或pip也无法安装,例如在windows环境下运行ez_setup.py 安装easy_install,可能遇到下图这样尴尬的情况. 图1 运行ez_setup.py失败 遇到这种问题可以”转战“国内的第三方镜像,问题便可迎刃而解.例如豆瓣镜像——http://pypi.douban.com/simple/ 1.安装easy_install 先安装ea

virtualenvwrapper 虚拟环境的使用 和 python 安装源的更改

virtualenvwrapper 虚拟环境的使用 鉴于virtualenv不便于对虚拟环境集中管理,所以推荐直接使用virtualenvwrapper. virtualenvwrapper提供了一系列命令使得和虚拟环境工作变得便利.它把你所有的虚拟环境都放在一个地方. 一  安装 pip install virtualenvwrapperpip install virtualenvwrapper-win #Windows使用该命令 二 配置虚拟环境的家目录(之后创建的虚拟环境的文件都在这个家目

python用pip安装扩展慢的问题可以用清华的源解决

python用pip安装扩展慢的问题可以用清华的源如下: pip install XXX -i https://pypi.tuna.tsinghua.edu.cn/simple 如刚刚安装 imageio-ffmpeg 库,在命令行输入以下指令,效果很好. pip install imageio-ffmpeg -i https://pypi.tuna.tsinghua.edu.cn/simple 原文地址:https://www.cnblogs.com/haozhanggy/p/12285021

python 3.7.2 源码安装遇到的一些问题总结

1.解压源码包 2.配置源码包./configure 3.编译和安装源码包make && make install 问题一.在编译和安装的过程中报错ModuleNotFoundError: No module named '_ctypes' 原因:其实是缺少了一个新需要的开发包libffi-devel,安装后即可 解决的方法: yum install libffi-devel -y 原文地址:https://www.cnblogs.com/shixi-study/p/11324725.ht

python 开发环境安装及配置

总结python 开发环境的安装及配置.一般安装 anaconda 和 pycharm 即可. 1. 安装 anaconda Anaconda指的是一个开源的Python发行版本,其包含了conda.Python等180多个科学包及其依赖项. 因为包含了大量的科学包,Anaconda 的下载文件比较大(约 531 MB),如果只需要某些包,或者需要节省带宽或存储空间,也可以使用Miniconda这个较小的发行版(仅包含conda和 Python) 简单来说,anaconda里面集成了很多关于py

解决pip国外安装源慢的问题

用默认的pip安装源pypi.python.org由于在国外经常会出现超时的问题,而且安装速度极其的慢,如下图中的超时问题=> 一.可通过以下方式解决. cat ~/.pip/pip.conf [global] timeout = 60 #设置超时时间 index-url = http://pypi.douban.com/simple #设置国内的镜像源,还有其他国内的源可以从网上进行搜索 二. pip install salt-api==0.8.4.1 Collecting salt-api=