奥奥の探索日记
ShaoAo
文章18
标签19
分类6

文章分类

开发包管理国内镜像源

开发包管理国内镜像源

使用包管理可以大大降低引用和管理第三方库的成本,但是很多源都在国外,通过包管理安装的时候,容易超时;我们可以通过修改为国内源,或者使用代理来解决这个问题。

提供Pip、Composer、NPM、Gem、Maven国内源地址。

Pip

提供方 源地址
豆瓣 pip install -i https://pypi.doubanio.com/simple/
清华大学 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple
阿里云 pip install -i https://mirrors.aliyun.com/pypi/simple/

Maven

提供方:阿里云

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0" encoding="UTF-8"?>
    <settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"

        xmlns="http://maven.apache.org/SETTINGS/1.1.0"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <mirrors>
        <mirror>
          <id>alimaven</id>
          <name>aliyun maven</name>
  <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
          <mirrorOf>central</mirrorOf>
        </mirror>
      </mirrors>
      <profiles>
        <profile>
            <repositories>
              <repository>
                <id>central</id>
                <name>Maven Repository Switchboard</name>
                <layout>default</layout>
                <url>http://repo1.maven.org/maven2</url>
                <snapshots>
                  <enabled>false</enabled>
                </snapshots>
              </repository>
            </repositories>
            <id>offical</id>
        </profile>
      </profiles>
      <activeProfiles>
        <activeProfile>offical</activeProfile>
      </activeProfiles>
    </settings>

Composer

提供方 源地址
阿里云 composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
华为云 composer config -g repo.packagist composer https://mirrors.huaweicloud.com/repository/php/
上海交通大学 composer config -g repo.packagist composer https://packagist.mirrors.sjtug.sjtu.edu.cn
composer config -g repo.packagist composer https://packagist.jp

NPM

提供方 源地址
淘宝 npm config set registry https://registry.npmmirror.com
淘宝 pnpm config set registry https://registry.npmmirror.com
淘宝 yarn config set registry https://registry.npmmirror.com
npm config set registry http://r.cnpmjs.org/
pnpm config set registry http://r.cnpmjs.org/
yarn config set registry http://r.cnpmjs.org/

Gem

提供方 源地址
Ruby China gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
清华大学 gem sources --add https://mirrors.tuna.tsinghua.edu.cn/rubygems/ --remove https://rubygems.org/

代理方式

包管理器 代理方式 使用方式
pip http/https https_proxy=http://ip:hort pip install
composer http/https https_proxy=http://ip:hort composer install
npm http/https npm config set proxy http://ip:port
npm config set https-proxy https://ip:port

yarn config set proxy http://ip:port
yarn config set https-proxy https://ip:port
gem http/https http_proxy=http://ip:host https_proxy=https://ip:host gem install
go http/https http_proxy=http://ip:host https_proxy=https://ip:host go get


本文作者:ShaoAo
本文链接:https://sawr.gitee.io/2023/09/05/tools/jingxiangyua/
版权声明:本文采用 CC BY-NC-SA 3.0 CN 协议许可,仅作个人记录,转载请说明出处!