PIPY Domestic Mirror currently has:
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
This is a convenient way to install the PIP online, but it's a terrible thing to do when the network is unstable. The use of domestic mirrors is relatively good,
If you want to specify the source manually, you can specify the source by following the PIP with-I, such as installing the web.py frame with the source of the watercress:
Pip Install Web.py-i http://pypi.douban.com/simple
Note that there is a/simple directory behind!!!
To be formulated as a default, you need to create or modify a configuration file (Linux files in ~/.pip/pip.conf,windows in%homepath%\pip\pip.ini), and modify the contents to:
Code
[Global]
Index-url = Http://pypi.douban.com/simple
This will call the mirror by default when it is installed using PIP.
For more configuration parameters see: http://www.pip-installer.org/en/latest/configuration.html
Configurationconfig file
PIP allows the set all command line option defaults in a standard INI style config file.
The names and locations of the configuration files vary slightly across platforms.
- On Unix and Mac OS X The configuration file is: $HOME/.pip/pip.conf
- On Windows, the configuration file is: %home%\pip\pip.ini
You can set a custom path location for the config file using the environment variable pip_config_file.
The names of the settings is derived from the long command line option, e.g. if you want to use a different package index (--index-url) and set the HTTP timeout (--default-timeout) to seconds your config file would look Li Ke this:
[Global] http://download.zope.org/ppix
Each subcommand can is configured optionally in its own sections so, every global setting with the same name would be OV Erridden; e.g. decreasing the timeout to ten seconds when running the freeze(freezing Requirements) comman D and using seconds for all other commands are possible with:
[Global] [Freeze]
Boolean options like --ignore-installed or --no-dependencies can is set like this:
[Install] trueYes
Appending options like --find-links can is written on multiple lines:
[Global] = http://download.example.com[Install]= http://mirror1.example.com http ://mirror2.example.com
Environment Variables
Pip ' s command line options can is set with environment variables using the formatpip_<upper_long_name> . Dashes (-) has to replaced with underscores (_).
For example, to set the default timeout:
Export pip_default_timeout=60
The same as passing the option to pip directly:
--Default-Timeout=[... ]
To set options The can is set multiple times on the command line, just add spaces in between values. For example:
Export pip_find_links= "Http://mirror1.example.com http://mirror2.example.com"
is the same as calling:
Pip Install--find-links=http://mirror1.example.com--find-links=http://mirror2.example.com
Config Precedence
Command Line Options has precedence over environment variables, which has precedence over the config file.
Within the config file, command specific sections has precedence over the global section.
Examples:
- --host=foo overrides Pip_host=foo
- Pip_host=foo overrides a config file with [global] HOST = foo
- A command Specific section in the config file [<command>] host = bar ove Rrides the option with same name in the [global] config file section
Command completion
Pip comes with the Support-command line completion in bash and zsh.
To setup for bash:
$ pip Completion--bash >> ~/.profile
To setup for zsh:
$ pip Completion--zsh >> ~/.zprofile
Alternatively, can use the result of the completion command directly with the Eval function of your shell, e.g . By adding the following to your startup file:
Eval "' Pip completion--bash '"
Next Previous
Window needs to be modified:
%python_home%\lib\site-packages\pip\cmdoptions.py
Java code
- Index_url = Optionmaker (
- '-I ', '--index-url ', ' --pypi-url ',
- dest=' Index_url ',
- metavar=' URL ',
- #default=' https://pypi.python.org/simple/',
- default=' http://mirrors.bistu.edu.cn/pypi/',
- help=' Base URL of the Python package Index (default%default).
%python_home%\lib\site-packages\pip\commands\search.py
Java code
- Class Searchcommand (Command):
- "" Search for PyPI packages whose name or summary contains <query>. " ""
- Name = ' Search '
- Usage = "" "
- %prog [Options] <query> "" "
- Summary = ' Search PyPI for packages '.
- def __init__ (self, *args, **kw):
- Super (Searchcommand, self). __init__ (*args, **kw)
- Self.cmd_opts.add_option (
- '--index ',
- dest=' index ',
- metavar=' URL ',
- #default=' Https://pypi.python.org/pypi ',
- default=' http://mirrors.bistu.edu.cn/pypi/',
- help=' Base URL of Python package Index (default%default) ')
- Self.parser.insert_option_group (0, self.cmd_opts)
[Linux] modifies the Easy_install and PIP image addresses
Using Easy_install and Pip will make it very easy to install and manage Pyhthon modules, but if you are in the country, the speed of downloading from the official image is a very maddening thing, like modifying a apt-get or yum mirror address, Easy_ Install and Pip also need to modify the mirror address. There are two ways to modify the mirror address of Easy_install and Pip, which can be implemented separately using commands and configuration.
Method 1: Temporarily modify the command mode
Easy_install:
1 |
Easy_install-i http://e.pypi.python.org/simple Fabric |
Pip:
1 |
Pip-i http://e.pypi.python.org/simple Install Fabric |
Method 2: Configure How to Modify
Easy_install:
1. Open Pydistutils.cfg
2. Write the following:
12 |
[Easy_install]index_url = Http://e.pypi.python.org/simple |
Pip:
1. Open pip.conf
2. Write the following:
12 |
[Global]index-url = Http://e.pypi.python.org/simple |
Faster domestic images, all from Tsinghua University, the server in Beijing. The server of the public network is the official mirror
Public network: Http://e.pypi.python.org/simple
Education Network: Http://pypi.tuna.tsinghua.edu.cn/simple
Use a domestic image source to accelerate the installation of Python PyPI packages