Python for Finance: Analyze Big Financial Data

(Elle) #1

conda allows one to search for libraries and packages, both locally and in available online


repositories:


$   conda   search  pytables
Fetching package metadata: ..
pytables . 2.4.0 np17py27_0 defaults
2.4.0 np17py26_0 defaults
2.4.0 np16py27_0 defaults
2.4.0 np16py26_0 defaults

                                                                                                    .       3.0.0                                                               np17py27_0      defaults
3.0.0 np17py26_0 defaults
3.0.0 np16py27_0 defaults
3.0.0 np16py26_0 defaults
. 3.0.0 np17py33_1 defaults
. 3.0.0 np17py27_1 defaults
3.0.0 np17py26_1 defaults
. 3.0.0 np16py27_1 defaults
3.0.0 np16py26_1 defaults
3.1.0 np18py33_0 defaults
* 3.1.0 np18py27_0 defaults
3.1.0 np18py26_0 defaults
3.1.1 np18py34_0 defaults
3.1.1 np18py33_0 defaults
3.1.1 np18py27_0 defaults
3.1.1 np18py26_0 defaults

The results contain those versions of PyTables that are available for download and


installation in this case and that are installed (indicated by the asterisk). Similary, the list


command gives all locally installed packages that match a certain pattern. The following


lists all packages that start with “pyt”:


$   conda   list    ^pyt
# packages in environment at /Library/anaconda:
#
pytables 3.1.0 np18py27_0
pytest 2.5.2 py27_0
python 2.7.6 1
python-dateutil 1.5 <pip>
python.app 1.2 py27_1
pytz 2014.2 py27_0

More complex patterns, based on regular expressions, are also possible. For example:


$   conda   list    ^p.*les$
# packages in environment at /Library/anaconda:
#
pytables 3.1.0 np18py27_0
$

Suppose we want to have Python 3.x available in addition to the 2.7.x version. The


package manager conda allows the creation of an environment in which to accomplish this


goal. The following output shows how this works in principle:


$   conda   create  -n  py33test    anaconda=1.9    python=3.3  numpy=1.8
Fetching package metadata: ..
Solving package specifications: .
Package plan for installation in environment /Library/anaconda/envs/py33test:

The following   packages    will    be  downloaded:

                package                                                                             |                                               build
–––––––––|–––––—
anaconda-1.9.2 | np18py33_0 2 KB
...
xlsxwriter-0.5.2 | py33_0 168 KB

The following   packages    will    be  linked:

                package                                                                             |                                               build
–––––––––|–––––—
anaconda-1.9.2 | np18py33_0 hard-link
...
Free download pdf