使用pypiserver快速搭建內網離線pypi倉庫實踐

hahadelphi發表於2021-09-09

前言

本文介紹瞭如何快速搭建一個pypiserver,透過自建pypiserver,我們可以解決網路環境不好,或者離線無法安裝python包的問題。如果結合最新的GitLab CI/CD和pipenv我相信各位還可以玩出更多的花樣。

pypiserver - minimal PyPI server for use with pip/easy_install

更新記錄

2018年04月12日 - 初稿

閱讀原文 -

擴充套件閱讀

pypiserver -

pypiserver 簡介

pypiserver is a minimal PyPI compatible server for pip or easy_install. It is based on bottle and serves packages from regular directories. Wheels, bdists, eggs and accompanying PGP-signatures can be uploaded either with pip, setuptools, twine, pypi-uploader, or simply copied with scp.

pypiserver 服務端配置

如果你的Linux環境缺少Python 2.7可以參考我的文章直接離線升級至最新版本

Python 2.6 升級至 Python 2.7 的實踐心得

pypiserver > 1.2.x works with python 2.7 and 3.3+ or pypy. Older python-versions may still work, but they are not tested. For legacy python versions, use pypiserver-1.1.x series.

# 替換pip為阿里雲,感概豆瓣的時代已經過去tee ~/.pip/pip.conf 

pypiserver 客戶端配置

## Download and Install hosted packages.pip install  --extra-index-url  ...# orpip install --extra-index-url  Search hosted packagespip search --index  ...# 個人推薦的配置tee ~/.pip/pip.conf 

pypiserver 進階配置

pypiserver Running as a systemd service

Adjusting the paths and adding this file as pypiserver.service into your systemd/system directory will allow management of the pypiserver process with systemctl, e.g. systemctl start pypiserver.

More useful information about systemd can be found at

# 安裝需要的包yum install nginx -y
pip install passlib pypiserver gunicorn# 建立pypiserver服務方便服務啟停管理tee /usr/lib/systemd/system/pypiserver.service 

 作者:王奧OX

連結:


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/2471/viewspace-2810464/,如需轉載,請註明出處,否則將追究法律責任。

相關文章