pipy国内镜像目前有:
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
Configuration
Config file
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.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 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/ppix
Each 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 = 10
Boolean options like --ignore-installed or --no-dependencies can be set like this:
[install]
ignore-installed = true
no-dependencies = yes
Appending 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.com
Environment Variables
pip’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=60
This 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.com
Config Precedence
Command 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=foo
- PIP_HOST=foo overrides a config file with [global] host = foo
- A command specific section in the config file [<command>] host = bar overrides the option with same name in the [global] config file section
Command Completion
pip comes with support for command line completion in bash and zsh.
To setup for bash:
$ pip completion --bash >> ~/.profile
To setup for zsh:
$ pip completion --zsh >> ~/.zprofile
Alternatively, 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`"
Window 需要修改:
%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 %default).')
%PYTHON_HOME%\Lib\site-packages\pip\commands\search.py
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]修改easy_install和pip的镜像地址
使用easy_install和pip会让Pyhthon的模块安装和管理变得非常简单,但是,如果你身在国内的话,从官方的镜像下载的速度是很令人抓狂的事情,如同修改apt-get或yum的镜像地址一样,easy_install和pip也需要修改镜像地址。修改easy_install和pip的镜像地址通常可以有以下两种方法,可以分别使用命令和配置方式实现。
方法1:命令方式临时修改
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 |
方法2:配置方式修改
easy_install:
1.打开pydistutils.cfg
1 |
vi ~/.pydistutils.cfg |
2.写入以下内容
1 2 |
[easy_install] index_url = http://e.pypi.python.org/simple |
pip:
1.打开pip.conf
1 |
vi ~/.pip/pip.conf |
2.写入以下内容
1 2 |
[global] index-url = http://e.pypi.python.org/simple |
速度比较快的国内镜像,都来自清华大学,服务器在北京。公网的服务器为官方镜像
公网:http://e.pypi.python.org/simple
教育网:http://pypi.tuna.tsinghua.edu.cn/simple
相关推荐
把国外PyPi源迅速切换化为国内源tuna, double, aliyun, 从而加快python包的安装速度。
这种方式是从Python的官方源pypi.python.org/pypi 下载到本地,然后解包安装。官方的pypi不稳定,下载非常慢。 解决方案是指定使用豆瓣镜像源,下载非常流畅 python3 -m pip install 包名 -i ...
通过使用此配置文件,用户可以轻松地将pip的默认源更改为清华大学的镜像源,从而加速包的下载和安装速度。 配合阅读:https://blog.csdn.net/m0_51246196/article/details/132261654?spm=1001.2014.3001.5501 配置...
Localshop是一个 PyPI 服务器,能够自动代理镜像PyPI包,基于包之上的请求。它支持上传本地(私有)包。
PyPi 镜像管理器
解决方案,使用国内的pypi镜像源,将Python默认的pypi镜像源更换为国内的pypi镜像源。使用国内一些pypi镜像,有两种方式,一种是临时指定pypi源,一种是永久修改pypi源。这样,无论是使用原生Python、Anaconda、...
清华镜像源安装 NGboost XGboost Catboost pip install catboost -i https://pypi.tuna.tsinghua.edu.cn/simple pip install ngboost -i https://pypi.tuna.tsinghua.edu.cn/simple pip install xgboost -i ...
Ubuntu 18.04基于bandersnatch搭建python Pypi本地镜像-很细节(csdn)————
pip国内的一些镜像 阿里云 http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 豆瓣(douban) http://pypi.douban.com/simple/ 清华大学 ...
资源分类:Python库 所属语言:Python 资源全名:rust_pypi-1.9.0-cp35-cp35m-manylinux1_x86_64.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源来自pypi官网。 资源全名:python_libnuml-1.1.3-cp39-cp39-manylinux1_x86_64.whl
Discourse SSO OIDC Bridge-一个Python PyPI软件包和一个Docker映像 ...请注意,这只会安装包含Flask应用程序的Python程序包,您必须使用gunicorn或其他WSGI兼容的网络服务器来托管它并设置TLS等。 pip insta
devpi:Python PyPi登台服务器以及打包,测试,发布工具
NULL 博文链接:https://youcou12.iteye.com/blog/2384563
cmd下使用清华镜像源加速 pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple 更多更换镜像源命令的使用见:清华大学开源软件镜像站pypi 镜像使用帮助 pip国内的一些镜像 阿里云 ...
python安装包-验证码识别(图片识别)包muggle-ocr的安装文件,可以直接使用pip安装。 下载之后解压缩,然后使用命令“pip install muggle-ocr-1.0.3.tar.gz -i https://pypi.douban.com/simple”,因为使用豆瓣下载...
一般使用python安装库,会用到pip install xxx 指令或者conda install xxx指令,因为pip和conda默认国外镜像源,这时会在Python的官方源pypi.python.org/pypi 下载,速度很慢,有时会因为超时会抛异常无法下载成功,...
https://www.lfd.uci.edu/~gohlke/pythonlibs/(推荐用这个地址下载whl文件,国内源,速度快。ctrl+f找到自己需要的文件) 2、 cmd到存放whl文件的目录 3、pip安装whl离线文件 pip install ****.whl (****.whl是...
pip 是 Python 包管理工具,该工具提供了对Python 包的查找、下载、安装、卸载的功能。 pip检测更新 命令:pip list –outdated pip升级包 命令:pip install –upgrade packagename pip卸载包 命令:pip ...