Mac OS X 10.8.5 get rid of all your problems with installing python libraries [numpy,scipy, matplotlib and plethora of others]

The solution I would like to present is python virtual environment.

You can create as many independent virual environments as you wish.

The advantages are:
-> you can create as many independent virual environments as you wish
-> easy installation of plethora of important libraries just with pip
-> you have in certain environment only this staff, you really want for your project, what is especially nice when you would like to share code/soultion with others.
-> no risk of damaging the core python library which is used by OS X
-> no problems with complex conflicts of libraries

OK. So how to create your first virtual env?
Assuming you have python installed.

You create (only once) new VIRTUALENV in yourDir by typing:

virtualenv yourDir/Python

You activate the existing VIRTUALENV by:

source yourDir/Python/bin/activate

Example.

I wanted to install scipy for some experimenting.

1. Open Terminal

2. type to create dir myexperiment on Desktop and build there virtualenv:
cd Desktop
mkdir myexperiment
virtualenv myexperiment/Python
source myexperiment/Python/bin/activate

3. now your virtualenv is activated. You should se in Terminal something like this
(Python)localhsot:Desktop $

4. you can install things you wish, which will be installed only in virtualenv:
pip install numpy
pip install scipy

About these ads

Dodaj komentarz

Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:

WordPress.com Logo

Komentujesz korzystając z konta WordPress.com. Log Out / Zmień )

Twitter picture

Komentujesz korzystając z konta Twitter. Log Out / Zmień )

Facebook photo

Komentujesz korzystając z konta Facebook. Log Out / Zmień )

Google+ photo

Komentujesz korzystając z konta Google+. Log Out / Zmień )

Connecting to %s