pipy国内镜像目前有:
新加个阿里云的镜像
pip install robotframework -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
http://pypi.douban.com/ 豆瓣
http://pypi.hustunique.com/ 华中理工大学
http://pypi.sdutlinux.org/ 山东理工大学
http://pypi.mirrors.ustc.edu.cn/ 中国科学技术大学
对于pip这种在线安装的方式来说,很方便,但网络不稳定的话很要命。使用国内镜像相对好一些,
如果想手动指定源,可以在pip后面跟-i 来指定源,比如用豆瓣的源来安装web.py框架:
pip install web.py -i http://pypi.douban.com/simple
注意后面要有/simple目录!!!
要配制成默认的话,需要创建或修改配置文件(linux的文件在~/.pip/pip.conf,windows在%HOMEPATH%\pip\pip.ini),修改内容为:
code:
[global]
index-url = http://pypi.douban.com/simple
这样在使用pip来安装时,会默认调用该镜像。
更多配置参数见:http://www.pip-installer.org/en/latest/configuration.html
pip allows you to 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.confOn Windows, the configuration file is: %HOME%\pip\pip.iniYou can set a custom path location for the config file using the environment variable PIP_CONFIG_FILE.
The names of the settings are 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 60 seconds your config file would look like this:
[global] timeout = 60 index-url = http://download.zope.org/ppixEach subcommand can be configured optionally in its own section so that every global setting with the same name will be overridden; e.g. decreasing the timeout to 10 seconds when running the freeze(Freezing Requirements) command and using 60 seconds for all other commands is possible with:
[global] timeout = 60 [freeze] timeout = 10Boolean options like --ignore-installed or --no-dependencies can be set like this:
[install] ignore-installed = true no-dependencies = yesAppending options like --find-links can be written on multiple lines:
[global] find-links = http://download.example.com [install] find-links = http://mirror1.example.com http://mirror2.example.compip’s command line options can be set with environment variables using the formatPIP_<UPPER_LONG_NAME> . Dashes (-) have to replaced with underscores (_).
For example, to set the default timeout:
export PIP_DEFAULT_TIMEOUT=60This is the same as passing the option to pip directly:
pip --default-timeout=60 [...]To set options that can be 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.comCommand line options have precedence over environment variables, which have precedence over the config file.
Within the config file, command specific sections have precedence over the global section.
Examples:
--host=foo overrides PIP_HOST=fooPIP_HOST=foo overrides a config file with [global] host = fooA command specific section in the config file [<command>] host = bar overrides the option with same name in the [global] config file sectionpip comes with support for command line completion in bash and zsh.
To setup for bash:
$ pip completion --bash >> ~/.profileTo setup for zsh:
$ pip completion --zsh >> ~/.zprofileAlternatively, you can use the result of the completion command directly with the eval function of you shell, e.g. by adding the following to your startup file:
eval "`pip completion --bash`" Next PreviousWindow 需要修改:
%PYTHON_HOME%\Lib\site-packages\pip\cmdoptions.py
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 Python Package Index (default