程序员

Nexus搭建Pypi私库

2019-03-01  本文已影响72人  宅男9号

系统环境:Windows 7 64位 专业版,以及 Windows 10 家庭中文版

第一步:搭建工具

第二步:配置代理仓库

第三步:配置pip

配置好的组仓库地址:http://localhost:8081/repository/pypi/

配置好仓库后,在使用时可以临时使用。

pip install -i http://localhost:8081/repository/pypi/simple some-package

也可以设为默认。更改pip请求配置如下:

pip config set global.index-url http://localhost:8081/repository/pypi/simple

注意: 要在仓库地址后加上simple

配置好仓库地址后,本地就可以正常访问了。但是由于是http的缘故,
非本机访问就会发现如下提示:

The repository located at xxx is not a trusted or secure host and is being ignored. 

这个时候需要验证服务器主机

pip install -i http://localhost:8081/repository/pypi/simple some-package --trusted-host localhost

也可以设为默认。更改pip请求配置如下:

pip config set install.trusted-host localhost
上一篇 下一篇

猜你喜欢

热点阅读