python使用内置的pip安装package很简单,以WINDOWS下使用为例说明,使用命令pipinstall包名即可。1、在命令行下切换到python目录,一般为c:\python27,pip在python安装目录的Scripts目录下,命令如下:cdc:\python27\scripts2、切换到目录之后直接使用命令安装即可,命令如下,例如要安装flask,则使用:pipinsatllflask3、其它说明,如果卸载包则使用pipuninstall包名来卸载包,以下为pip参数说明:Usage:pip[options]Commands:installInstallpackages.downloadDownloadpackages.uninstallUninstallpackages.freezeOutputinstalledpackagesinrequirementsformat.listListinstalledpackages.showShowinformationaboutinstalledpackages.searchSearchPyPIforpackages.wheelBuildwheelsfromyourrequirements.hashComputehashesofpackagearchives.completionAhelpercommandusedforcommandcompletionhelpShowhelpforcommands.GeneralOptions:-h,--helpShowhelp.--isolatedRunpipinanisolatedmode,ignoringenvironmentvariablesanduserconfiguration.-v,--verboseGivemoreoutput.Optionisadditive,andcanbeusedupto3times.-V,--versionShowversionandexit.-q,--quietGivelessoutput.--logPathtoaverboseappendinglog.--proxySpecifyaproxyintheform[user:passwd@]proxy.server:port.--retriesMaximumnumberofretrieseachconnectionshouldattempt(default5times).--timeoutSetthesockettimeout(default15seconds).--exists-actionDefaultactionwhenapathalreadyexists:(s)witch,(i)gnore,(w)ipe,(b)ackup.--trusted-hostMarkthishostastrusted,eventhoughitdoesnothavevalidoranyHTTPS.--certPathtoalternateCAbundle.--client-certPathtoSSLclientcertificate,asinglefilecontainingtheprivatekeyandthecertificateinPEMformat.--cache-dirStorethecachedatain.--no-cache-dirDisablethecache.--disable-pip-version-checkDon'tperiodicallycheckPyPItodeterminewhetheranewversionofpipisavailablefordownload.Impliedwith--no-index.4、注意事项,如果在windows下安装失败提示:Unabletofindvcvarsall.bat,则说明这个包需要编译,则要在WINDOWS系统中安装visualstudio2008。5、linux下pip安装package与WINDOWS的语法相同,使用pipinstallSomePackage即可,linux下需要注意的是权限问题,应当使用root用户执行命令。
取消
评论