企业内网利用devpi搭建pypi私服
生活随笔
收集整理的這篇文章主要介紹了
企业内网利用devpi搭建pypi私服
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
安裝devpi
概述
devpi包含三個組件:
- devpi-server: 提供鏡像與緩存功能,在企業DMZ區部署,提高下載python package的效率
- devpi-web: 提供web界面與查詢功能
- devpi-client: 命令行工具, 提供包上傳等功能
devpi-server
# 若devpi-server與互聯網不通,可通過設置代理來安裝 # pip --proxy http://proxy_server:3128 install -q -U devpi-serverpip install -q -U devpi-server devpi-server --version初始化與初次啟動
devpi-server --init devpi-server --start測試
pip install -i http://localhost:3141/root/pypi/ simplejson pip uninstall -y simplejson easy_install -i http://localhost:3141/root/pypi/+simple/ simplejson pip uninstall -y simplejsondevpi-web
pip install -q -U devpi-web devpi-server --stop devpi-server --recreate-search-index devpi-server --start pip search --index http://localhost:3141/root/pypi/ devpi-client常用命令
devpi-server --init devpi-server --start devpi-server --stop devpi-server --status devpi-server --logdevpi behind proxy
export http_proxy="http://proxy_server:3128" export https_proxy="http://proxy_server:3128" export no_proxy="localhost,10.0.0.0/8,172.16.0.0/12" devpi-server --startnginx reverse proxy
# http block upstream pypi.example.com {server 127.0.0.1:3141;keepalive 16; }# server block location ~ /(root|\+search) {proxy_pass http://pypi.example.com;proxy_http_version 1.1;proxy_set_header Connection "";proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }客戶端設置
pip
# Linux: $HOME/.pip/pip.conf # Windows 7: C:\ProgramData\pip\pip.ini # windows xp: C:\Documents and Settings\All Users\Application Data\pip\pip.ini # or use environment variable PIP_CONFIG_FILE to specify location# please replace example.com to your REAL domain name[global] index-url = http://pypi.example.com/root/pypi/+simple/[install] trusted-host=pypi.example.com[search] index = http://pypi.example.com/root/pypi/easy_install
# $HOME/.pydistutils.cfg: [easy_install] index_url = http://pypi.example.com/root/pypi/+simple/參考
- Quickstart: running a pypi mirror on your
laptop - Configure devpi-server to work behind proxy server at
workplace
作者:田園牧歌w
鏈接:https://www.jianshu.com/p/cc600c36e549
來源:簡書
著作權歸作者所有。商業轉載請聯系作者獲得授權,非商業轉載請注明出處。
總結
以上是生活随笔為你收集整理的企业内网利用devpi搭建pypi私服的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 电视猫的节目单_湖南卫视2020年电视剧
- 下一篇: mysql中唯一索引的关键字是什么