First, install the Pip2pi tool:
Pip Install Pip2pi
Or:
git clone https://github.com/wolever/pip2picd pip2pipython setup.py Install
Second, create a storage package repository:
Mkdir/opt/python/soft/pypi.jb51.net
Third, download the package and build the index:
Download a package separately
pip2tgz/opt/python/soft/pypi.jb51.net/routes==1.12.3
Bulk Download Packages:
pip2tgz/opt/python/soft/pypi.jb51.net/-R List/requirements.txt
To build an index:
dir2pi/opt/python/soft/pypi.jb51.net/
Update index:
Pip2acmeco uliweb=0.2.6 pip2acmeco-r List/requirements.txt
Four, the combination of Nginx configuration Web side:
Nginx Server Add Virtual Host configuration:
server { listen; 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;}
So far has been configured to their own private pypi the need for what software package, the time of their own to put in their own pypi inside it can be;
In the same vein, you can put your own project in the package.
Five, how to better use the PyPI Source:
For example, install the Uliweb.
Pip Install--index-url=http://www.php.cn/uliweb
Or
Pip Install-i Uliweb
This is not very troublesome, do not want to go by default on their own PyPI source? Well, here's a good way to think about it:
Create a ~/.pip/pip.conf file under Linux with the following file contents
[Global]index-url = http://www.php.cn/
If it is a Windows environment, create:%homepath%\pip\pip.ini
The content is the same as above Linux.
At the same time recommend a few relatively good domestic pypi source:
Http://pypi.douban.com Watercress http://pypi.hustunique.com Huazhong University of Technology http://pypi.sdutlinux.org Shandong University of Technology/HTTP Pypi.mirrors.ustc.edu.cn China University of Science and Technology
PS: There are two ways to modify the source used by Easy_install and Pip
(for example, download installation requests from the mirror source e.pypi.python.org on Linux):
Command mode: For one-time use, temporary modification
Easy_install
Easy_install-i Http://e.pypi.python.org/simple Requests
Pip
Pip Install Requests-i http://e.pypi.python.org/simple
Note: 1. The source path should contain the/simple part; 2. The-i parameter should be placed behind the install XXX when using PIP
Modify (if not, create) EASY_INSTALL/PIP configuration file
Easy_install: Write the following in the ~/.pydistutils.cfg configuration file:
[Easy_install]index_url = Http://e.pypi.python.org/simple
Pip: Write in the ~/.pip/pip.conf configuration file:
[Global]index-url = Http://e.pypi.python.org/simple