您的位置:首页 > 运维架构 > Linux

windows和linux中搭建python集成开发环境IDE——如何设置多个python环境

2016-02-01 12:25 1061 查看
本系列分为两篇:

1、【转】windows和linux中搭建python集成开发环境IDE

2、【转】linux和windows下安装python集成开发环境及其python包

3、windows和linux中搭建python集成开发环境IDE——如何设置多个python环境

InstallPythonpackagesonUbuntu14.04

fromchris'sandbox

InthispostIwilldocumentmysetupofPython2.7.6inUbuntu14.04.Ofcourse,thebasePythonisinstalledbydefault,bothPython2.7.6andPython3.4.Trythefollowingintheterminal:

$python--version
Python2.7.6
$python2--version
Python2.7.6
$python3--version
Python3.4.0


Asyoucansee,usingpythonpointstoPython2.7.6bydefault.However,python2andpython3canbeusedtoaccessthedesiredversion.IwillfocusoninstallingpackagesforPython2.7.6here.

Strategy

InthepastIhaveinstalledPythonpackages:

UsingtheUbunturepository:

$sudoapt-getinstallpackagename


Or,fromagit/svnrepository:

$sudopythonsetup.pyinstall


Approach1hasmanyadvantagesforPythonusersthatdon’tneedtohavethelatestversionsofeverypackage.Inparticular,allofthepackagedependenciesincludingotherPythonpackages,linearalgebralibraries,etc.arealsoinstalledautomatically.Asaresult,ifyouarenewtoUbuntuandPython,strategy1isthewaytogo.

Iwilltakeadifferenttact,usingpiptoinstall,upgrade,andremovepackages.Also,IwillinstallallPythonpackagesasauser,thatis,nouseofsudo.ThismakesiteasytousethesameinstallprocedureonamachinewhereIdon’thavesudoprivileges–sayanUbuntucluster.However,Iwillneedsudotoinstallnon-Pythonlibraries,Fortrancompilers,etc.thatthePythonpackagesemploy.Onacluster,theSysAdminwouldhavetotodothispartformeandotherusers.

–startedit:2015,June1st–

RecentlyuseofpiponUbuntu14.04hasstartedtoissueawarningthatendswithInsecurePlatformWarning.Aftersomesearchingaround,I’vefoundthatthisisrelatedtoSSLandtheurllib3inPython2.7.6,theversiononUbuntu14.04–seehereifyouwantthedetails.Assuggestedinthediscussionlinkedabove,thiscanbefixedwiththefollowinginstalls(I’llusethe–userswitch,asintheexamplesbelow)

$pipinstall--userpyopensslndg-httpsclientpyasn1


Withthatwe’resecuredandthewarningsgoaway.Ifyouarejuststartingout,tryinstallingpip,asbelow,andreturntothisinstallifuseofpipgivesyouwarnings.

–endedit:2015,June1st–

pip

Ofcourse,thestartingpointistogetpipinstalled.Officialinstructionsarealsoavailableforinstallingpip.pipdependsonsetuptools,butwecaninstallbothusingtheget-pip.pyscript,asdescribedattheinstalllink.Tobeconcrete,Ididthefollowing:

$cd~/Downloads
$curl-Ohttps://bootstrap.pypa.io/get-pip.py$pythonget-pip.py--user


Ifyoudon’thavecurlinstalled,thiscanberemediedusing:

$sudoapt-getinstallcurl


Becausewehavechosenlocalinstallation,thepath~/.local/binhastobeaddedtoourpath.Todothat,addthefollowingtotheendofyour~/.bashrcfile:

#include.local/binforlocalpythonscripts
exportPATH=~/.local/bin:$PATH


Then,source~/.bashrc:

$source~/.bashrc


Trythefollowingtoseeifyougetsimilarresultsandtomakesurethebasicsetupisworking:

$whichpip
/home/cstrelioff/.local/bin/pip
$pip--version
pip1.5.6from/home/cstrelioff/.local/lib/python2.7/site-packages(python2.7)


Ofcourse,yourusernameshouldbeinthepath,buttheoutputshouldlooksomethingliketheabove.

virtualenv

AnothermajortoolforPython2.7projectmanagementisvirtualenv.ThispackageallowstheusertocreatemanyvirtualPythonenvironments,withdifferentpackagesinstalled,andtoactivateanddeactivetheseenvironmentswhenevertheuserdesires.Thisisextremelyusefulfordeveloperswhowanttocreateaminimalenvironmentfortheirapplication.

Thevirtualenvinstallationissimplewithpip(again,I’mdoingauserinstallwithnosudo):

$pipinstall--uservirtualenv


Totestitout,seeifyougetsomethinglikethefollowing:

$virtualenv--version
1.11.6
$pipshowvirtualenv
---
Name:virtualenv
Version:1.11.6
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:


Nowthatvirtualenvisinstalled,therewillbetwopathsforwardfortherestofthePythoninstalls:

Keepinstallingasauser–I’llusethisapproachforthereasonsdiscussedabove.

Ifyouhaveadminpermissionsyoucaninstallallpackagesgloballyusingacommandlike:

$sudopipinstallpackagename


CreateavirtualenvironmentandinstalleverythingtheretohaveacompletelyisolatedPythonenvironment–seevirtualenvandvirtualenvwrapperonUbuntu14.04foranexampleofhowtotakethisapproach.

Ubuntudependencies

AvarietyofUbuntu-specificpackagesareneededbyPythonpackages.Thesearelibraries,compilers,fonts,etc.I’lldetailtheseherealongwithinstallcommands.Dependingonwhatyouwanttoinstallyoumightnotneedallofthese.

Generaldevelopment/build:

$sudoapt-getinstallbuild-essentialpython-dev


Compilers/codeintegration:

$sudoapt-getinstallgfortran
$sudoapt-getinstallswig


Numerical/algebrapackages:

$sudoapt-getinstalllibatlas-dev
$sudoapt-getinstallliblapack-dev


Fonts(formatplotlib)

$sudoapt-getinstalllibfreetype6libfreetype6-dev


Morefonts(formatplotlibonUbuntuServer14.04–seecommentatendofpost)–added2015/03/06

$sudoapt-getinstalllibxft-dev


Graphvizforpygraphviz,networkx,etc.

$sudoapt-getinstallgraphvizlibgraphviz-dev


IPythonrequirepandocfordocumentconversions,printing,etc.

$sudoapt-getinstallpandoc


Tinkererdependencies

$sudoapt-getinstalllibxml2-devlibxslt-devzlib1g-dev


That’sit,nowwestartinstallingthePythonpackages.

numpy

numpyisoneofthefundamentalnumericalpackagesinPython.Toinstallusingpiptype:

$pipinstall--usernumpy


Thiswillresultinafairamountofcompilingfollowedbyanotethatthepackagewassuccessfullyinstalled.Ifnot,makeanoteoftheerror.Oftenthisresultsfromnothavinglibrariesand/orcompilersinstalled(seeabove).

Informationabouttheinstallationlocationandtheversioncanbeobtainedwiththefollowing:

$pipshownumpy
---
Name:numpy
Version:1.8.1
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:


Youshouldalsobeabletostartpythonattheterminalandimportnumpywithoutcomplaint:

Python2.7.6(default,Mar222014,22:59:56)
[GCC4.8.2]onlinux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>importnumpyasnp
>>>printnp.__version__
1.8.1
>>>exit()


scipy

scipyhasmanyusefulmathematicalutilities,complementingnumpy.Installationisaccomplishedwith:

$pipinstall--userscipy


Again,expectlotsofcompiling!Aswithnumpy,try:

$pipshowscipy
---
Name:scipy
Version:0.14.0
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:


and,loadingpython:

Python2.7.6(default,Mar222014,22:59:56)
[GCC4.8.2]onlinux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>importscipy
>>>printscipy.__version__
0.14.0
>>>exit()


matplotlib

matplotlibisoneofthemainplottingpackagesforPythonandmanyotherpackagesusetheutilities.Installwith:

$pipinstall--usermatplotlib

matplotlib复杂一点,可能直接上面的操作会失败:需要先安装其依赖的包libpng和freetype,根据提示缺啥就补安装啥即可:

安装libpng:sudoapt-getinstalllibpng-dev

安装freetype:

cd~/Downloads

wgethttp://download.savannah.gnu.org/releases/freetype/freetype-2.4.10.tar.gz
tarzxvffreetype-2.4.10.tar.gz

cdfreetype-2.4.10/

./congfigure

make

sudomakeinstall




Ifyoulookcarefully,thecompletionoftheinstallationwillsay:

Successfullyinstalledmatplotlibpython-dateutiltornadopyparsingnose
backports.ssl-match-hostname
Cleaningup...


So,matplotlibinstallsavarietyofPython-dependencies.Asusual,try:

$pipshowmatplotlib
---
Name:matplotlib
Version:1.3.1
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:numpy,python-dateutil,tornado,pyparsing,nose


Finallytryasimpleplot:

Python2.7.6(default,Mar222014,22:59:56)
[GCC4.8.2]onlinux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>importmatplotlib.pyplotasplt
>>>plt.plot([1,2,3,4])
[<matplotlib.lines.Line2Dobjectat0x7f13a8571890>]
>>>plt.ylabel('somenumbers')
<matplotlib.text.Textobjectat0x7f13a85c47d0>
>>>plt.show()
>>>exit()


Aplotshouldopeninanewwindowwhenplot.show()isexecuted.

sympy

sympyisacomputeralgebrasystemforPython.Installwithpipusing:

$pipinstall--usersympy


Again,installationinformationfrompipisobtainedwith:

$pipshowsympy
---
Name:sympy
Version:0.7.5
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:


Finally,followingthesympytutorial,startPythonandtry:

Python2.7.6(default,Mar222014,22:59:56)
[GCC4.8.2]onlinux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>fromsympyimportsymbols
>>>x,y=symbols('xy')
>>>expr=x+2*y
>>>expr
x+2*y
>>>expr+1
x+2*y+1
>>>expr-x
2*y
>>>exit()


Cool!

IPython

Next,weinstallIPython(includingnotebooks),whichhasbecomeamajortoolforsharingpythonprojectsinaninteractiveformat.Toinstallweuse:

$pipinstall--useripython[notebook]


Attheend,wegetthemessage:

Successfullyinstalledipythonjinja2pyzmqmarkupsafe
Cleaningup...


showingthatjinja2,pyzmqandmarkupsafehavealsobeeninstalled.Getinstallinformationfrompip:

$pipshowipython
---
Name:ipython
Version:2.1.0
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:


Now,try:

$ipython


whichlaunchestheIPythonterminal.NoticetheIPythonversionisprovidedandthepromptlooksdifferentfromthenormal>>>Pythonprompt(seetheIPythondocumentationformoreinformation):

Python2.7.6(default,Mar222014,22:59:56)
Type"copyright","credits"or"license"formoreinformation.

IPython2.1.0--AnenhancedInteractivePython.
?->IntroductionandoverviewofIPython'sfeatures.
%quickref->Quickreference.
help->Python'sownhelpsystem.
object?->Detailsabout'object',use'object??'forextradetails.

In[1]:importnumpyasnp

In[2]:printnp.__version__
1.8.1

In[3]:exit()


Finally,IPythonnotebookcanbelaunchedwiththecommand:

$ipythonnotebook


ThislaunchesawebbrowserandyoushouldseetheIPythonnotebookinterface.Youcancreateanewnotebookandworkaway.Toshutdowntheserver,backattheterminalwhereyoulaunchedthenotebook,typecntrl-Candthenywhenprompted:

Shutdownthisnotebookserver(y/[n])?y
2014-06-0416:29:04.033[NotebookApp]CRITICAL|Shutdownconfirmed
2014-06-0416:29:04.033[NotebookApp]Shuttingdownkernels


That’sit,you’renowanIPythonnotebookuser!

pygraphviz

pygraphvizisaPythoninterfacetothegraphvizvisualizationcodethatcanbeusedbyitselfbutisalsoemployedbynetworkxandotherpackages.Besurethatgraphvizanditsdeveloperlibrariesareinstalled(seeUbuntuDependenciesabove)andinstallpygraphvizusing:

$pipinstall--userpygraphviz


Getinstallinformationfrompip:

$pipshowpygraphviz
---
Name:pygraphviz
Version:1.2
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:


Also,try:

Python2.7.6(default,Mar222014,22:59:56)
[GCC4.8.2]onlinux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>importpygraphviz
>>>printpygraphviz.__version__
1.2
>>>exit()


networkx

networkxisaPythonpackageforbuilding,analyzing,andvisualizinggraphs/networks.Thereareavarietyofdependencies,allofwhichwehaveinstalledabove.So,installwith:

$pipinstall--usernetworkx


Getinstallinformationfrompip:

$pipshownetworkx
---
Name:networkx
Version:1.8.1
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:


Tryasimpleexample:

Python2.7.6(default,Mar222014,22:59:56)
[GCC4.8.2]onlinux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>importnetworkxasnx
>>>G=nx.Graph()
>>>G.add_edge(1,2)
>>>G.add_edge(2,3)
>>>importmatplotlib.pyplotasplt
>>>nx.draw(G)
>>>plt.show()
>>>exit()


Withmatplotlibandpygraphvizinstalled(seeabove),thiscodeshouldcreateaverysimplegraphandshowitinanewwindowwhenplt.show()isexecuted.

pandas

pandasisaPythonpackagedfocusedondata–reading,writing,manipulating,etc.Thereareavarietyofpandasdependencies:required,recommendedandoptional.We’llfocusonthefirsttwocategories.

Therequireddependenciesarenumpy(installedabove),python-dateutil(installedabovewithmatplotlib),andpytz(wewillletpipinstallwithpandas).However,let’sinstalltherecommendeddependencies:

numexpr

$pipinstall--usernumexpr


Afterinstallweget:

$pipshownumexpr
---
Name:numexpr
Version:2.4
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:numpy


bottleneck

$pipinstall--userBottleneck


Afterinstallweget:

$pipshowBottleneck
---
Name:Bottleneck
Version:0.8.0
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:


WecanalsoimportbothpackagesinPythonandprintthepackageversiontomakesurethatbasicusageseemsokay:

$python-c"importnumexpr;printnumexpr.__version__"
2.4
$python-c"importbottleneck;printbottleneck.__version__"
0.8.0


Finally,forpandas,weinstallthemainpackage:

$pipinstall--userpandas


Aftersomedownloadingandcompilingweget(showingthatbothpandasandpytzwereinstalled,asexpected):

Successfullyinstalledpandaspytz
Cleaningup...


Usepiptochecktheinstallationinformation:

$pipshowpandas
---
Name:pandas
Version:0.14.0
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:python-dateutil,pytz,numpy


Note:ifyouimportpandas,anerroraboutopenpyxl(apackageforworkingwithExcel2007files)willbeissued:

Python2.7.6(default,Mar222014,22:59:56)
[GCC4.8.2]onlinux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>importpandas
/home/cstrelioff/.local/lib/python2.7/site-packages/pandas/io/excel.py:626:UserWarning:Installedopenpyxlisnotsupportedatthistime.Use>=1.6.1and<2.0.0.
.format(openpyxl_compat.start_ver,openpyxl_compat.stop_ver))
>>>exit()


Theerrorsaysthatopenpyxlneedstobeatleastversion1.6.1andlessthan2.0.0.Strange,thispackageislistedasoptional.Ohwell,let’sinstallanappropriateversion.Ifwejustusepiptoinstallthecurrentversionitwillbetoohigh.So,Iinstalledasfollows:

openpyxl1.8.6

$pipinstall--useropenpyxl==1.8.6


Thisinstallforcestheuseanappropriateversion.Now,tryimportingpandasandweget:

Python2.7.6(default,Mar222014,22:59:56)
[GCC4.8.2]onlinux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>importpandas
>>>printpandas.__version__
0.14.0
>>>importopenpyxl
>>>printopenpyxl.__version__
1.8.6
>>>exit()


Yay(!)wecanimportpandas(andopenpyxl)withoutcomplaints.

Finally,beforeleavingpandas,Iwillmentionthatthereareavarietyofoptionalpandasdependenciesthatyoumightwanttoconsideraswell.Iwon’tconsidertheminthispost.

pymc

pymcisareallyniceMCMCpackageforPython.Ihaveuseditonseveralprojectswithgreatsuccess.Installationwithpipfollowstheusualformat:

$pipinstall--userpymc


Getinstallinformation:

$pipshowpymc
---
Name:pymc
Version:2.3.2
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:


StartingPythonyoushouldalsobeabletoget:

Python2.7.6(default,Mar222014,22:59:56)
[GCC4.8.2]onlinux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>importpymc
>>>printpymc.__version__
2.3.2
>>>exit()


statsmodels

statsmodelsprovidessomenicestatisticsmethods.Beforeinstallingstatsmodelsitself,wemustinstalldependencies,whichwilllikelybeusesulinanycase:patsyandcython.

patsy:isapackagefordescribingstatisticalmodelsinR-likeformat.Installwith:

$pipinstall--userpatsy


Wecanseewherepipinstalledpatsy:

$pipshowpatsy
---
Name:patsy
Version:0.2.1
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:numpy


andtryimportingpatsyinaPythonsession:

Python2.7.6(default,Mar222014,22:59:56)
[GCC4.8.2]onlinux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>importpatsy
>>>printpatsy.__version__
0.2.1
>>>exit()


cython:allowsforwrappingofc++code.Installwith:

$pipinstall--userCython


Checkwithpip:

$pipshowCython
---
Name:Cython
Version:0.20.1
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:


andimportinginaPythonsession:

Python2.7.6(default,Mar222014,22:59:56)
[GCC4.8.2]onlinux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>importcython
>>>printcython.__version__
0.20.1
>>>exit()


Finally,installstatsmodelswithpip:

$pipinstall--userstatsmodels


Showinstallinfowithpip:

$pipshowstatsmodels
---
Name:statsmodels
Version:0.5.0
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:


andtryanimport:

Python2.7.6(default,Mar222014,22:59:56)
[GCC4.8.2]onlinux2
Type"help","copyright","credits"or"license"formoreinformation.
>>>importstatsmodels
>>>printstatsmodels.__version__
0.5.0
>>>exit()


Okay,that’spatsy,cythonandstatsmodels.

CMPy

CMPyisapackageforComputationalMechanicsinPythondevelopedintheCrutchfieldLabatUCDavis.Currentlythepackageisdeveloped,usinggitforversioncontrol,butisnotpubliclyavailable.However,Iwilldocumenttheinstallherebecause:

It’susefulforpeopleatUCD(orcollaboratingwithpeopleatUCD)

ThisisanexampleofinstallationofaPythonpackageinafolderonthelocalmachine

IstartbyshowingthatIhaveclonedtheCMPypackagetothe~/gitlocal/cmpy/directory.Youcanseethesetup.pyfilewhenIshowthedirectorycontents:

$ls~/gitlocal/cmpy/
appsbuildCHANGES.txtcmpydatadocsgalleryLICENSE.txtMANIFEST.inold_docpylintrcREADME.txtscriptssetup.pysrc


Wedotheinstallwithpip,usingthe-eswitchtoshowthelocationofthepackagecode:

$pipinstall--user-e~/gitlocal/cmpy/
Obtainingfile:///home/cstrelioff/gitlocal/cmpy
Runningsetup.py(path:/home/cstrelioff/gitlocal/cmpy/setup.py)egg_infoforpackagefromfile:///home/cstrelioff/gitlocal/cmpy

Installingcollectedpackages:CMPy
Runningsetup.pydevelopforCMPy

Creating/home/cstrelioff/.local/lib/python2.7/site-packages/CMPy.egg-link(linkto.)
AddingCMPy1.0devtoeasy-install.pthfile

Installed/home/cstrelioff/gitlocal/cmpy
SuccessfullyinstalledCMPy
Cleaningup...


NotethatthepathtotheCMPydirectoryisaddedtoeasy-install.pth,afilethatPythonconsultstofindCMPy.Finally,weshowthepipinformation:

$pipshowcmpy
---
Name:CMPy
Version:1.0dev
Location:/home/cstrelioff/gitlocal/cmpy
Requires:


Again,notethatthelocationis~/gitlocal/cmpy/,insteadof~/.local/lib/python2.7/site-packages/,duetothe-etag.Thisiswhytheadditiontotheeasy_install.pthfile(above)wasneeded.

Edit:Aug21st,2014

Anoteonupdatingthislocalinstallationisinorder.Recentlyachangeincodewasmadethataffectedunderlyingccodethatisincorporatedusingcython.Ipulledtherepositorychangesusing:

$cd~/gitlocal/cmpy/
$gitpull


TotryandupdatetheinstallIdid:

$pipinstall--user-e~/gitlocal/cmpy/


Thisranthesetup.pyfilebutdidnotrecompilethemodifiedccode.TogetthistoworkIhadtoremovethebuilddirectory,buildinplaceandinstallagain:

$cd~/gitlocal/cmpy/
$rm-rbuild/
$pythonsetup.pybuild_ext-i--cython
$pipinstall--user-e~/gitlocal/cmpy/


Isthereabetterwaytodothis?Letmeknowinthecommentsbelow.

restview

restviewisaPythonpackagethatprocessesreStructuredTextandlaunchesawebbrowserforviewing.Eachtimethebrowserisrefreshed,theunderlyingrstdocumentwillbere-processedanddisplayed–veryniceforworkingonPythondocmentationoranyrstdocument.Installationgoesasusual:

$pipinstall--userrestview


Wecanseewhatwasinstalled:

$pipshowrestview
---
Name:restview
Version:2.0.5
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:docutils,pygments


Asyoucanseefromabove,docutilsandpygmentswillbeinstallediftheyarenotalreadyinstalled.

Toprocessanrstdocumentnamedtest.rsttype:

$restviewtest.rst


Checkrestviewformoreexamples.

tinkerer

tinkererisabloggingenvironmentforPythonistasthatisbuiltonSphinx,aPythondocumentationtool.BlogentriesarewritteninreStructuredTextandrenderedasstatichtml.Ofcourse,thisisalsothetoolIuseforthisblog.Beforemovingtoourusualpipinstall,wehavetotakecareofsomeUbuntu14.04Pythondependencies.Assumingtheserequirementsareavailable,tinkererisinstalledwiththeusual:

$pipinstall--usertinkerer


Wecanchecktheinstallinformationwith:

$pipshowtinkerer
---
Name:Tinkerer
Version:1.4.2
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:Jinja2,Sphinx,Babel,pyquery


NotethatrequirementsJinja2,Sphinx,Babelandpyqueryarealsoinstalledautomatically.Aquickstarttogettingablogupandrunning(atleastthegenerationofposts,pagesandgeneratingthehtmloutput)isavailablehere.

Pweave

PweaveisatoolforliterateprogrammingwithPython.ThistoolallowsmetowriteblogpostsaboutPythonusinga.PnwfilethatcontainsreStructuredText,alongwithspecialPweavecommands,andhavethePythoncodeevaluatedandoutputincludedinthe.rstoutputfile–seetheexamplehere.Thisisareallynicetooltoavoidtyposincodeandtomakesurethatwhatyou’retalkingaboutactuallyworks!IshouldnotethatIPythonnotebookscanalsodothisbyexportingtoreStructuredText.Inanycase,Iwilltryingoutbothofthesetoolsforfutureposts.

TheinstallofPweavegoesasusual:

$pipinstall--userPweave


Checktheinstallwith:

$pipshowPweave
---
Name:Pweave
Version:0.21.2
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:


scikit-learn

scikit-learnistheprobablythemostwell-knownandfeature-completepackageformachinelearningtasksinPython.Thereareanumberofdependenciesthatneedtobeinstalled(numpy,scipy,python-dev,etcseescikit-learninstallationformoreinformation)thathavealreadybeeninstalledabove.So,weinstallusingpip,asusual:

$pipinstall--userscikit-learn


Thenwecanchecktheinstalledversionandlocationusing:

$pipshowscikit-learn
---
Name:scikit-learn
Version:0.15.1
Location:/home/cstrelioff/.local/lib/python2.7/site-packages
Requires:


That’sit,machine-learnaway!

PostedbyChrisStrelioff
Tags:python2.7,ubuntu14.04,python,myubuntusetup,pip,virtualenv,numpy,scipy,matplotlib,sympy,ipython,pygraphviz,networkx,pandas,numexpr,bottleneck,openpyxl,pymc,statsmodels,patsy,cython,cmpy,restview,tinkerer,pweave,scikit-learn

«InstallingOctaveonUbuntu14.04
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: