最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Python中pip安裝非PyPI官網(wǎng)第三方庫的方法

 更新時(shí)間:2015年06月02日 15:52:24   投稿:junjie  
這篇文章主要介紹了Python中pip安裝非PyPI官網(wǎng)第三方庫的方法,pip最新的版本(1.5以上的版本), 出于安全的考 慮,pip不允許安裝非PyPI的URL,本文就給出兩種解決方法,需要的朋友可以參考下

在python中安裝非自帶python模塊,有三種方式:

1.easy_install
2.pip
3.下載壓縮包(.zip, .tar, .tar.gz)后解壓, 進(jìn)入解壓縮的目錄后執(zhí)行python setup.py install命令

本文主要針對(duì)pip安裝時(shí)可能會(huì)碰到的一種情況,及解決辦法:

假如我要安裝pylint模塊,該模塊非python自帶模塊,用import肯定不能導(dǎo)入,需要額外安裝

復(fù)制代碼 代碼如下:

>>> import pylint 
Traceback (most recent call last): 
  File "<stdin>", line 1, in <module> 
ImportError: No module named pylint 

【現(xiàn)象】

執(zhí)行pip install <modulename>命令,報(bào)錯(cuò)如下:

復(fù)制代碼 代碼如下:

D:\>pip install pylint --allow-external pylint 
Downloading/unpacking pylint 
Requirement already satisfied (use --upgrade to upgrade): six in c:\python27\lib\site-packages\six-1 
.8.0-py2.7.egg (from pylint) 
Downloading/unpacking astroid>=1.3.6 (from pylint) 
  Real name of requirement astroid is astroid 
  Could not find any downloads that satisfy the requirement astroid>=1.3.6 (from pylint) 
  Some insecure and unverifiable files were ignored (use --allow-unverified astroid to allow). 
Cleaning up... 
No distributions at all found for astroid>=1.3.6 (from pylint) 
Storing debug log for failure in C:\Users\aaa\pip\pip.log 

【分析】

在Perl中安裝新模塊,一般可以用PPM圖形化工具,也可以用CPAN來安裝,比如說: cpan>install Test::Class, 非常方便,不會(huì)碰到這種情況,這種情況主要是因?yàn)閜ip版本問題: pip最新的版本(1.5以上的版本), 出于安全的考
慮,pip不允許安裝非PyPI的URL,因?yàn)樵摪惭b文件實(shí)際上來自pylint.org,因而導(dǎo)致上面的錯(cuò)誤!

NOTE:

1. 可以在官方changelog里面查看更改的信息
2. 可以用pip --version來查看pip的版本信息

復(fù)制代碼 代碼如下:

C:\>pip --version 
pip 1.5.6 from C:\Python27\lib\site-packages (python 2.7) 

【辦法】

針對(duì)上面的情況,既然這個(gè)問題是因?yàn)閜ip版本的原因,可以改用pip低一點(diǎn)的版本
方法一: 用pip 1.4版本,再執(zhí)行pip install pylint命令來安裝
方法二: 執(zhí)行命令時(shí),加上--allow-all-external, --allow-unverified及依賴包版本(astroid==1.3.6)

復(fù)制代碼 代碼如下:

pip install pylint --allow-all-external pylint astroid==1.3.6 --allow-unverified pylint

NOTE:
1. --allow-all-external   # 允許所有外部地址的標(biāo)簽,只有打上該標(biāo)簽pip方可下載外部地址模塊
2. --allow-unverified     #  pip沒有辦法校驗(yàn)外部模塊的有效性,所以必須同時(shí)打上該標(biāo)簽
3. astroid==1.3.6          #  依賴包必須要添加上,并賦予其版本號(hào),pip方能從列表下載    

方法三: 在當(dāng)前目錄下,新增requirements.txt,內(nèi)容如下:

復(fù)制代碼 代碼如下:

# requirements.txt 
--allow-all-external pylint 
--allow-unverified pylint 
pylint 
--allow-all-external astroid==1.3.6 

再執(zhí)行: pip install -r requirements.txt
【結(jié)論】
1. pip這個(gè)設(shè)計(jì)不夠友好,使用也很不方便,遠(yuǎn)不如Perl中的PPM,期待Python中也有這么個(gè)工具。
2. 如果碰到這種錯(cuò),導(dǎo)致不能安裝模塊的話: 直接下載壓縮包安裝好了。 >>>下載包地址<<<
3. 執(zhí)行pip -h命令查看更新pip相關(guān)的幫助信息

復(fù)制代碼 代碼如下:

Usage:    
  pip <command> [options] 
 
Commands: 
  install                     Install packages. 
  uninstall                   Uninstall packages. 
  freeze                      Output installed packages in requirements format. 
  list                        List installed packages. 
  show                        Show information about installed packages. 
  search                      Search PyPI for packages. 
  wheel                       Build wheels from your requirements. 
  zip                         DEPRECATED. Zip individual packages. 
  unzip                       DEPRECATED. Unzip individual packages. 
  bundle                      DEPRECATED. Create pybundles. 
  help                        Show help for commands. 
 
General Options: 
  -h, --help                  Show help. 
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times. 
  -V, --version               Show version and exit. 
  -q, --quiet                 Give less output. 
  --log-file <path>           Path to a verbose non-appending log, that only logs failures. This log is active by default at pip.log. 
  --log <path>                Path to a verbose appending log. This log is inactive by default. 
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port. 
  --timeout <sec>             Set the socket timeout (default 15 seconds). 
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup. 
  --cert <path>               Path to alternate CA bundle. 

相關(guān)文章

  • pyecharts實(shí)現(xiàn)數(shù)據(jù)可視化

    pyecharts實(shí)現(xiàn)數(shù)據(jù)可視化

    這篇文章主要介紹了pyecharts實(shí)現(xiàn)數(shù)據(jù)可視化,pyecharts 是百度開源的,適用于數(shù)據(jù)可視化的工具,配置靈活,展示圖表相對(duì)美觀,順滑,下面更多詳細(xì)內(nèi)容,需要的小伙伴可以參考一下
    2022-03-03
  • pandas的to_datetime時(shí)間轉(zhuǎn)換使用及學(xué)習(xí)心得

    pandas的to_datetime時(shí)間轉(zhuǎn)換使用及學(xué)習(xí)心得

    這篇文章主要給大家介紹了關(guān)于pandas的to_datetime時(shí)間轉(zhuǎn)換使用及學(xué)習(xí)心得的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用pandas具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-08-08
  • python缺失值的解決方法總結(jié)

    python缺失值的解決方法總結(jié)

    在本篇文章里小編給大家整理的是一篇關(guān)于python缺失值的解決方法總結(jié),有需要的朋友們可以跟著學(xué)習(xí)下。
    2021-06-06
  • PyQt5按下按鍵選擇文件夾并顯示的實(shí)現(xiàn)

    PyQt5按下按鍵選擇文件夾并顯示的實(shí)現(xiàn)

    這篇文章主要介紹了PyQt5按下按鍵選擇文件夾并顯示的實(shí)現(xiàn)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2021-03-03
  • 使用Nibabel庫對(duì)nii格式圖像的讀寫操作

    使用Nibabel庫對(duì)nii格式圖像的讀寫操作

    這篇文章主要介紹了使用Nibabel庫對(duì)nii格式圖像的讀寫操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2020-07-07
  • Python疫情數(shù)據(jù)可視化分析

    Python疫情數(shù)據(jù)可視化分析

    這篇文章主要介紹了Python疫情數(shù)據(jù)可視化分析,本數(shù)據(jù)集主要涉及到全球疫情統(tǒng)計(jì),包括確診、治愈、死亡、時(shí)間、國家、地區(qū)等信息,需要的朋友可以參考一下
    2022-07-07
  • python實(shí)現(xiàn)動(dòng)態(tài)GIF英數(shù)驗(yàn)證碼識(shí)別示例

    python實(shí)現(xiàn)動(dòng)態(tài)GIF英數(shù)驗(yàn)證碼識(shí)別示例

    這篇文章主要為大家介紹了python實(shí)現(xiàn)動(dòng)態(tài)GIF英數(shù)驗(yàn)證碼識(shí)別示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2024-01-01
  • 正則表達(dá)式的概念介紹和python實(shí)踐應(yīng)用詳解

    正則表達(dá)式的概念介紹和python實(shí)踐應(yīng)用詳解

    在Python中正則表達(dá)式是一種強(qiáng)大的文本處理工具,它允許你根據(jù)特定的模式匹配字符串中的子串,這篇文章主要介紹了正則表達(dá)式的概念和python實(shí)踐應(yīng)用的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2025-10-10
  • Python reversed函數(shù)及使用方法解析

    Python reversed函數(shù)及使用方法解析

    這篇文章主要介紹了Python reversed函數(shù)及使用方法解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-03-03
  • 詳解Django框架中的視圖級(jí)緩存

    詳解Django框架中的視圖級(jí)緩存

    這篇文章主要介紹了詳解Django框架中的視圖級(jí)緩存,Django是最具人氣的Python web開發(fā)框架,需要的朋友可以參考下
    2015-07-07

最新評(píng)論

方山县| 西平县| 汉寿县| 离岛区| 嘉义市| 紫云| 历史| 南澳县| 光山县| 罗江县| 垦利县| 扬中市| 高尔夫| 棋牌| 宕昌县| 富平县| 方城县| 桦甸市| 彰化市| 浏阳市| 大连市| 宁晋县| 南平市| 理塘县| 镇安县| 石家庄市| 绩溪县| 仁怀市| 同德县| 正安县| 增城市| 井研县| 京山县| 南澳县| 河池市| 镇安县| 塔城市| 台东县| 云林县| 西峡县| 宁阳县|