1. Install the pip2pi tool:
##
pip install pip2pi
git clone https://github.com/wolever/pip2pi cd pip2pi python setup.py install
2. Create a warehouse to store the software package:
mkdir /opt/python/soft/pypi.jb51.net
3. Download the software package And create an index:
Download a software package individuallypip2tgz /opt/python/soft/pypi.jb51.net/ routes==1.12.3
pip2tgz /opt/python/soft/pypi.jb51.net/ -r list/requirements.txt
dir2pi /opt/python/soft/pypi.jb51.net/
pip2acmeco uliweb=0.2.6 pip2acmeco -r list/requirements.txt
4. Configure the web side with nginx:
Nginx server adds virtual host configuration:server { listen 80; server_name pypi.jb51.net; root /opt/python/soft/pypi.jb51.net; location /{ autoindex on; autoindex_exact_size off; #显示文件的大小 autoindex_localtime on; #显示文件时间 #limit_rate_after 5m; #5分钟后下载速度限制为200k limit_rate 200k; } access_log logs/pypi.jb51.net.access.log main; }
5. How to better use pypi source:
For example, install uliwebpip install --index-url=http://www.php.cn/ uliweb
pip install -i uliweb
[global] index-url = http://www.php.cn/
http://pypi.douban.com 豆瓣 http://pypi.hustunique.com 华中理工大学 http://pypi.sdutlinux.org 山东理工大学 http://pypi.mirrors.ustc.edu.cn 中国科学技术大学
PS: There are two ways to modify the source used by easy_install and pip
(from the mirror source e.pypi.python.org on Linux Download and install requests as an example):
easy_install -i http://e.pypi.python.org/simple requests
pip install requests -i http://e.pypi.python.org/simple
[easy_install] index_url = http://e.pypi.python.org/simple
[global] index-url = http://e.pypi.python.org/simple