Tagged: pip

软件源加速

Yum 加速

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

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

# Centos TencentCloud
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo

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

# Centos 7 TencentCloud
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo

# 生成缓存
yum clean all
yum makecache

Epel加速

# 安装
yum install epel-release -y

# 备份
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup

# epel(RHEL6系列)
wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-6.repo

# epel(RHEL7系列)
wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-7.repo

Pypi加速

  • windows建立 %HOMEPATH%\pip\pip.ini 文件,写入如下内容;
  • Linux 建立 ~/.pip/pip.conf 文件,写入如下内容;
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host=mirrors.aliyun.com

[list]
format=columns 
[global]
index-url = https://mirrors.cloud.tencent.com/pypi/simple
trusted-host = mirrors.cloud.tencent.com

pip常用命令

yum -y install python-pip python-wheel
pip list --format=columns

# 升级
pip install -U pip setuptools
# 如果安装的是for all user的话需要使用如下参数升级,否则可能报错
pip install -U pip setuptools --user
# 若升级后pip报错,可以使用如下命令试试
easy_install pip

pip search [module]
pip install [module]

# 创建虚拟环境
python3 -m venv /path/to/new/virtual/environment
python3 -m venv c:\path\to\myenv

Npm加速

# 临时使用
npm --registry https://registry.npm.taobao.org install express

# 持久使用
# Aliyun
npm config set registry https://registry.npm.taobao.org

# TencentCloud
npm config set registry http://mirrors.cloud.tencent.com/npm/
# 配置后可通过下面方式来验证是否成功
npm config get registry
# 或
npm info express

Docker CE

# CentOS/RHEL
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo

# 把软件仓库地址替换为
sudo sed -i 's+download.docker.com+mirrors.cloud.tencent.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo

# 安装
yum makecache fast 
yum install docker-ce

Maven

打开maven的设置文件settings.xml,配置如下repository mirror:

<mirror>
    <id>nexus-tencentyun</id>
    <mirrorOf>*</mirrorOf>
    <name>Nexus tencentyun</name>
    <url>http://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url>
</mirror> 

更多腾讯云加速地址请查看:https://mirrors.cloud.tencent.com/index.html

Archives