Tutorial on building your own PIP source in Python environment

Source: Internet
Author: User
Tags nginx server
First, install the Pip2pi tool:

Pip Install Pip2pi

Or:

git clone http://www.php.cn/cd pip2pipython setup.py Install

Second, create a storage package repository:

mkdir/opt/python/soft/pypi.php.cn

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://pypi.jb51.net/simple/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://pypi.PHP.cn/simple

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.