Wednesday 22 May 2013

Install Python in Linux (Ubuntu)

How To install Python in Linux (Ubuntu)

Method: 1
 
After install Linux, you can install python very easily by some command, so follow below steps,

1. first open your Terminal and go to root directory, see below picture and put this command

apt-get install lamp-server^  
 

so by this command lamp server will install.

  2. After install lamp server , check phpmyadmin is installed or not, if not install then give this command

apt-get install phpmyadmin 
 
3. Actually at the time of lamp server installation, python become install so you have to check python is install or not by this command

python
 
 if install then u will see like this,

root@BLR02BSS:~# python
Python 2.7.3 (default, Aug  1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

 

4.  In your system, if synaptic manager is not install then give this command

apt-get install synaptic

If synaptic manager is install already then on command terminal type

synaptic

It will open Synaptic manager there you search "python mysql", you will get below screen

then click on checkbox for mark as installation and Apply on the top
then Python mysqldb will install in your system

Now in your system python and mysqldb is installed successfully.


Method: 2

Step 1: Download and build Python
First Download Zip file from here  Python
Go to http://www.python.org/. In the "Quick links" section on the left-hand side of the page, "Source distribution" is a direct link to the tarball. Download it. Unzip the tarball, and from the root of the created directory (which will be called Python-2.7.2 or something similar, depending on the version): 
Open terminal  and put this command

./configure
 
make -j


You can now check that Python was correctly built by executing ./python and falling into its interactive terminal. If you want, you can also execute the Python test-suite with make test, though it may take a long time to run (~10 minutes on a relatively fast machine).

Step 2: Install
In the same directory, run:

sudo make install

This installs Python into /usr/local/bin. Depending on the configuration of your system, you may want to add symlinks to the newly created /usr/local/bin/python2.7 in /usr/bin/ as well.
That’s it, you now have Python 2.7 installed.
Now you can install Python mysqldb, follow above steps for python mysqldb.

or

Now extract it in C or any drive, then open the command prompt and go through directory where python zip file kept. just like as 
c: \>  cd c:\programfiles\python\
c: \programfiles\python> setup.py install
or 
c: /programfiles/python>python setup.py install

No comments:

Post a Comment