日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

pipy国内镜像

發(fā)布時(shí)間:2025/3/15 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 pipy国内镜像 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

pipy國(guó)內(nèi)鏡像目前有:

新加個(gè)阿里云的鏡像

pip install robotframework?-i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

?

http://pypi.douban.com/ ?豆瓣

http://pypi.hustunique.com/ ?華中理工大學(xué)

http://pypi.sdutlinux.org/ ?山東理工大學(xué)

http://pypi.mirrors.ustc.edu.cn/ ?中國(guó)科學(xué)技術(shù)大學(xué)

?

對(duì)于pip這種在線安裝的方式來(lái)說(shuō),很方便,但網(wǎng)絡(luò)不穩(wěn)定的話很要命。使用國(guó)內(nèi)鏡像相對(duì)好一些,

?

如果想手動(dòng)指定源,可以在pip后面跟-i 來(lái)指定源,比如用豆瓣的源來(lái)安裝web.py框架:

pip install web.py -i http://pypi.douban.com/simple

?

注意后面要有/simple目錄!!!

?

要配制成默認(rèn)的話,需要?jiǎng)?chuàng)建或修改配置文件(linux的文件在~/.pip/pip.conf,windows在%HOMEPATH%\pip\pip.ini),修改內(nèi)容為:

code:

[global]

index-url = http://pypi.douban.com/simple

?

這樣在使用pip來(lái)安裝時(shí),會(huì)默認(rèn)調(diào)用該鏡像。

更多配置參數(shù)見(jiàn):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`" Next?Previous


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會(huì)讓Pyhthon的模塊安裝和管理變得非常簡(jiǎn)單,但是,如果你身在國(guó)內(nèi)的話,從官方的鏡像下載的速度是很令人抓狂的事情,如同修改apt-get或yum的鏡像地址一樣,easy_install和pip也需要修改鏡像地址。修改easy_install和pip的鏡像地址通常可以有以下兩種方法,可以分別使用命令和配置方式實(shí)現(xiàn)。

    方法1:命令方式臨時(shí)修改
    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.打開(kāi)pydistutils.cfg

    1 vi ~/.pydistutils.cfg

    2.寫(xiě)入以下內(nèi)容

    1 2 [easy_install] index_url = http://e.pypi.python.org/simple

    pip:
    1.打開(kāi)pip.conf

    1 vi ~/.pip/pip.conf

    2.寫(xiě)入以下內(nèi)容

    1 2 [global] index-url = http://e.pypi.python.org/simple

    總結(jié)

    以上是生活随笔為你收集整理的pipy国内镜像的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。