Build a local pypi source using pip2pi

Source: Internet
Author: User

When a team develops a project, the required Python third-party packages are basically fixed. Every time we build a new environment, it is always caused by various Intranet and Internet resources, HTTPS issues take a lot of time to install the runtime environment. Therefore, you can build a local, small, and only contain the package source, or cache, which can save a lot of time to build the environment.


Pip2pi is used here. You can specify a download source, which is officially available in pypi or in China. You can synchronize the required packages to the local device and then build a web service locally, all users in the LAN can quickly build the python Environment After configuring the PIP source.


The lab environment is window7.


Step 1 install pip2pi

1    pip install pip2pi


Step 2 configure the PIP source on the local machine to edit the c: \ Users \ Administrator \ Pip. ini file (the content is as follows). If no file exists, create one. Here is Douban.

[global]timeout = 60index-url = http://pypi.douban.com/simple

Step 3 synchronize the Software Package

1. Single Synchronization

# Pip2tgz/pypi name = version/pypi is the folder where these packages are stored. Here E: \ pipy is used.

E:\dev1\nirvana>pip2tgz E:\pipy simplejsonDownloading/unpacking simplejson  Downloading simplejson-3.5.3.tar.gz (70kB): 70kB downloadedSaved e:\pipy\simplejson-3.5.3.tar.gzRunning setup.py egg_info for package simplejson Successfully downloaded simplejsonCleaning up... Done. 1 new archives currently saved in ‘E:\\pipy‘.

Now we can see the simplejson package in the pipy folder.

2 Pip export file synchronization

# Pip2tgz/var/www/packages/-r requirements.txt foo== 1.2 Baz/

The content of the requirement.txt file used here is

Django==1.5.5MySQL-python==1.2.3amqp==1.0.12anyjson==0.3.3billiard==2.7.3.31celery==3.0.19django-celery==3.0.17django-kronos==0.3httplib2==0.8kombu==2.5.12python-dateutil==2.1pytz==2013breportlab==2.7six==1.3.0wsgiref==0.1.2xlwt==0.7.5


Pip2tgz E: \ pipy-r requirement.txt run

Download all the packages and install them automatically (strange)


Step 4: Create an update index (the whole index is to generate a webpage File Based on the package in the directory, and then build the Web service to install it directly using PIP)

Index the entire directory

1 E:\dev1>dir2pi E:\pipy


Update the index.

12 pip2acmeco namepip2acmeco -r requirements.txt



You can use Apache or nginx to build a local web service, and then update the pip. ini file on other machines to use your own source.

For details, refer to: set up local pypi source method and configure pipy source method.



This article is from the "orangleliu notebook" blog, please be sure to keep this http://orangleliu.blog.51cto.com/2554001/1440304

Build a local pypi source using pip2pi

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.