Installing Python

Published on Author alexandrejaguarLeave a comment

Hey scientist! How do you do? Today we’ll install Python and some scientific packages on your PC. These packages will be necessary on our adventure in the Python scientific programming world! Let’s do this!

Let’s start from the beginning. Python is a simple but powerful, easy-to-learn language. It was created by Guido van Rossum [1], the Benevolent Dictator for Life (or BDFL for the closest ones). Python can be used for several things, from embedded systems [2] to really cool simulations like pybotwar [3], a simulation of robot battles, or PLANET [4], the simulation of the Newton laws to bodies that attract each other.

Python is available in two versions, 2 and 3. There are some differences between them; they’re better explained here [5]. The short explanation says that “Python 2.x is legacy, Python 3.x is the present and future of the language”… but that’s not reeealy the truth. Python 2 is still out there, and some useful extension libraries were not imported to Python 3 yet. I keep the two versions installed on my PC, running Linux Mint 17.1 [6].

Installing Python is quite simple in Linux environments. Version 2 is already installed by default in possibly every penguin system. If this doesn’t happen in your distro, you can use your cute package manager available, or use the terminal. In the Debian Linux distro and its relatives (which use .deb packages), you can type:

In Red Hat and based distros (which use .rpm packages), I believe you can use this:

Installing Python 3 is kinda the same thing:

Or

Please help us in the comments if the commands are wrong 🙂

Besides the Linux installation, packages for several distributions (Windows, Mac OS, among several others) can be downloaded at [7].

But wait! This is a science-aimed blog, so we have to install some interesting packages too. These packages are (for now):

  • IDLE [8] and IPython [9]: nice systems for quick coding. They offer you a prompt [10] for typing your instructions and have your answers after that.
  • Numpy [11] and Scipy [12]: they provide functions for thousands of commands. These packages are the fundamental support for science in Python.
  • Matplotlib [13]: 2D/3D plots.
  • Mayavi [14]: 3D plots.
  • Pandas [15]: structures for data analysis.
  • Scikit-image [16] and Scikit-learn [17]: image processing and machine learning, respectively.
  • Simpy [18]: discrete simulation.
  • Sympy [19]: symbolic math.

I’ll show you how to install them in a Debian (.deb) environment, OK? For Python 2.7 use the command below:

For Python 3.4:

There aren’t versions of Scikit-learn and Sympy for Python 3 available on Ubuntu repositories (Mint uses it also), but I think they’ll be available soon. If you’re in a hurry, you can compile these packages in your system: these are the instructions for Scikit-learn [20] and for Sympy [21]. Go for it!

A last comment: there is a system named Anaconda, that offers all these scientific packages, and a lot others. Please don’t get confused with another Anaconda!

You can download Anaconda for Windows, Mac OS, Linux, choose the Python version, among other stuff. Download it at [22]. The list of packages contained in Anaconda is in [23].

I never used Anaconda; I prefer the versions available in the repositories. If you use or used it, please comment how nice it is!
Gigaregards!


Did you like this post? Please comment and share with your friends!
Want to download Programming Science codes? Go to our GitHub!
I’m on Twitter: @alexdesiqueira! Follow me if you can!
Make a donation for Programming Science!

ShareEmail this to someoneShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on RedditShare on TumblrPin on Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *