pip镜像管理和npm镜像管理

pqi

下载pqi,用pqi来管理镜像源。终端下运行

pip install pqi

查看镜像源。

pqi ls
图片.png

查看用法。

pqi -h

显示当前使用的镜像源。默认使用pypi。

pqi show

更改为阿里云镜像,下载速度将会快很多。

pqi use aliyun



有时当你使用anaconda,用了env隔开其他环境,可能会导致fetch不到url上的包。

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.Could not fetch URL https://mirrors.aliyun.com/pypi/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPo
ol(host='mirrors.aliyun.com', port=443): Max retries exceeded with url: /pypi/simple/pip/ (Caused by SSLError("Can't connect to HTTPS
URL because the SSL module is not available.")) - skipping

我参考了这篇文章:
点这里
关键用这句,比如我下numpy:

pip install numpy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com





如果不想使用pqi,也可用这个命令改为清华镜像源

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

也可尝试下载psm

pip install psm

查看有什么镜像

psm ls

使用阿里云(淘宝)镜像

psm use aliyun




npm

下载nrm,用nrm来管理镜像源。

npm --registry https://registry.npm.taobao.org install nrm

查看镜像源

nrm ls
图片.png

由于刚刚我们指定了淘宝镜像源下载nrm,所以此时用的是淘宝镜像。
可以用切换镜像。

nrm use <镜像名>

比如切换到yarn源

nrm use yarn

查看现在镜像

nrm current

当然除了指定仓库,也可以下载cnpm,然后用cnpm代替npm下载东西也是很快的,因为cnpm用的是淘宝镜像源。
下载cnpm

npm --registry https://registry.npm.taobao.org install cnpm

比如我要下载express

cnpm install express

其实可以看到cnpm与npm用法差不多。

你可能感兴趣的:(pip镜像管理和npm镜像管理)