Original link: http://www.lnmpy.com/pypi-mirror/
Cross-platform in Python, so this doesn't describe my local environment. Install Pypimirror
Install Pypimirror First
Pip Install Z3c.pypimirror
BeautifulSoup version mismatch error will occur during installation
Downloading/unpacking beautifulsoup<=3.0.9999 (from Z3c.pypimirror) Could not find a version that satisfies the Require ment beautifulsoup<=3.0.9999 (from Z3c.pypimirror) (from versions:3.2.0, 3.2.1) Cleaning up ... No distributions matching the version for beautifulsoup<=3.0.9999 (from z3c.pypimirror) storing debug log for failure I N/home/topgear/.pip/pip.log
Modify the/usr/local/lib/python2.7/dist-packages/z3c.pypimirror-1.0.16-py2.7.egg/egg-info/requires.txt file. (I am Ubuntu here, the configuration of the specific distribution may be different)
One line is: beautifulsoup<=3.0.9999, the version number is removed, namely: BeautifulSoup. After you have changed, then re-execute the installation command above. Configure Pypimirror.cfg
Configuring the Pypimirror.cfg file, saving the path doesn't matter
[DEFAULT] # Local storage path for image file Mirror_file_path =/opt/pypi/# remote Mirror URL base_url = http://0.0.0.0/pypi # log File Log_filename = /var/log/pypi-mirror.log # Lock file prevents duplicate runs lock_file_name =/tmp/pypi-mirror.lock # days to fetch in past on update fetch_s ince_days = 1 # File type that requires a mirrored copy, not in the list does not copy filename_matches = *.zip *.tgz *.egg *.tar.gz *.tar.bz2 # file name that requires a mirrored copy, not a column The table is not copied # default copy all, the above has been deleted the type package_matches = * # Delete the local have and the server does not have the package # default is True, will be deleted, here I adjust to false cleanup = false # to create the index text Piece create_indexes = true # display believe information verbose = True
Copy remote Mirror
Execute pypimirror-h to see Pypimirror's Help information
-I: Initializing mirroring
-U: Update the image (when it has already been initialized, only the updates that need to be synchronized)
-I: Create an index for a local file
-C: Output to console at the same time
-V: Show more information
Pypimirror-c-v-i Pypimirror.cfg # First need to initialize PYPIMIRROR-C-v-u pypimirror.cfg # can be updated if a local mirror already exists
To create a local index
Pypimirror-c-v-i pypimirror.cfg
Integrating Apache
Actually, it's simply a soft link.
Ln-sf/opt/pypi/var/www/pypi
Use local source
Using the image source is simple, specifying it with-I is OK:
Easy_install-i Http://127.0.0.1/pypi/django pip Install-i Http://127.0.0.1/pypi/django
Of course, you will find some source even if you specify a third-party source (local source), it unexpectedly still downloaded from the official source, so (= ̄ω ̄=), change the source of Pip or Easy_install, replace the code HardCode official source bar. reference build local PyPI server Setting up a PyPI mirror