Python environment to build your own pip source tutorial, pythonpip

Source: Internet
Author: User
Tags nginx server

Python environment to build your own pip source tutorial, pythonpip

1. Install the pip2pi tool:

pip install pip2pi

Or:

git clone https://github.com/wolever/pip2picd pip2pipython setup.py install

2. Create a warehouse for storing software packages:

mkdir /opt/python/soft/pypi.jb51.net

3. download the software package and create an index:

Download a software package separately

pip2tgz /opt/python/soft/pypi.jb51.net/ routes==1.12.3

Batch download software packages:

pip2tgz /opt/python/soft/pypi.jb51.net/ -r list/requirements.txt

Index creation:

dir2pi /opt/python/soft/pypi.jb51.net/

Update index:

pip2acmeco uliweb=0.2.6 pip2acmeco -r list/requirements.txt

4. Configure the web end with nginx:

Add virtual host configuration for the Nginx Server:

Server {listen 80; server_name pypi.jb51.net; root/opt/python/soft/pypi.jb51.net; location/{autoindex on; autoindex_exact_size off; # display the file size autoindex_localtime on; # display file time # limit_rate_after 5 m; # download speed limit of 200 k limit_rate 200 k in 5 minutes;} access_log logs/pypi.jb51.net. access. log main ;}

Now that you have configured your own private pypi, you can get it and put it in your own pypi;

Similarly, you can package your project.

5. how to better use the pypi Source:

For example, install uliweb.

pip install --index-url=http://pypi.jb51.net/simple/ uliweb

Or

pip install -i uliweb

This is not a problem. Do you want to use your own pypi source by default? Okay, I have already figured out a method for you:

Create in linux ~ The/. pip/pip. conf file contains the following content:

[global]index-url = http://pypi.jb51.net/simple

In windows, create: % HOMEPATH % \ pip. ini

The content is the same as that in linux.

We also recommend several good domestic pypi sources:

Http://pypi.douban.com Douban 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 sources used by easy_install and pip.
(Download and install requests from image source e.pypi.python.org on Linux as an example ):

Command method: temporary modification for one use

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 must contain/simple; 2. When pip is used, the-I parameter should be placed behind install xxx.

Modify the configuration file easy_install/pip.

Easy_install: In ~ /. Pydistutils. cfg:

[easy_install]index_url = http://e.pypi.python.org/simple

Pip: In ~ /. Pip/pip. conf:

[global]index-url = http://e.pypi.python.org/simple

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.