Python for Finance: Analyze Big Financial Data

(Elle) #1
                zlib-1.2.7                                                                  |                                                               1           hard-link

Proceed ([y]/n)?

When you type y to confirm the creation, conda will do as proposed (i.e., downloading,


extracting, and linking the packages):


***UPDATE**

Fetching    packages    ...
anaconda-1.9.2-np18py33_0.tar.bz2 100% |##########| Time: 0:00:00 173.62 kB/s
...
xlsxwriter-0.5.2-py33_0.tar.bz2 100% |############| Time: 0:00:01 131.32 kB/s
Extracting packages ...
[ COMPLETE ] |##########################| 100%
Linking packages ...
[ COMPLETE ] |##########################| 100%
#
# To activate this environment, use:
# $ source activate py33test
#
# To deactivate this environment, use:
# $ source deactivate
#

Now activate the new environment as advised by conda:


$   source  activate    py33test
discarding /Library/anaconda/bin from PATH
prepending /Library/anaconda/envs/py33test/bin to PATH
(py33test)$ python
Python 3.3.4 |Anaconda 1.9.2 (x86_64)| (default, Feb 10 2014, 17:56:29)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>> print “Hello Python 3.3” # this shouldn’t work with Python 3.3
File “<stdin>”, line 1
print “Hello Python 3.3” # this shouldn’t work with Python 3.3
^
SyntaxError: invalid syntax
>>> print (“Hello Python 3.3”) # this syntax should work
Hello Python 3.3
>>> exit()
$

Obviously, we indeed are now in the Python 3.3 world, which you can judge from the


Python version number displayed and the fact that you need parentheses for the print


statement to work correctly.


[ 8 ]

MULTIPLE PYTHON ENVIRONMENTS

With the conda package manager you can install and use multiple separated Python environments on a single

machine. This, among other features, simplifies testing of Python code for compatibility with different Python

versions.

Single libraries and packages can be installed using the conda install command, either


in the general Anaconda installation:


$   conda   install scipy

or for a specific environment, as in:


$   conda   install -n  py33test    scipy

Here, py33test is the environment we created before. Similarly, you can update single


packages easily:


$   conda   update  pandas

The packages to download and link depend on the respective version of the package that is


installed. These can be very few to numerous, e.g., when a package has a number of

Free download pdf