Results 1 to 4 of 4

Thread: Issues installing mysqldb-python

  1. #1

    Joined
    Jun 2012
    Posts
    1,699
    Thanks
    876
    Thanked
    2,881/1,142
    DL/UL
    44/1
    Mentioned
    562 times
    Time Online
    118d 6h 45m
    Avg. Time Online
    40m

    Issues installing mysqldb-python

    I am trying to install mysqldb-python onto a centos vps server via ssh terminal. Heres what im doing:


    easy_install mysql-python

    Now when i run python from terminal:
    Last login: Thu Dec 6 14:23:54 2012 from -----------
    [root@fkn ~]# python2.7
    Python 2.7.2 (default, Oct 30 2012, 15:05:12)
    [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import MySQLdb
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: No module named MySQLdb
    >>>


    What I think the problem may be:

    When I run "python scriptname.py" python 2.4 loads by default , So I use "python2.7 scriptname.py" the package manager in plesk does not allow me to uninstall the default python as Centos uses it.


    So I tried the above test with just the standard python installation:

    [root@fkn ~]# python
    Python 2.4.3 (#1, Jun 18 2012, 08:55:23)
    [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import MySQLdb
    >>>


    This works! So my easyinstall is installing the script for the wrong python is there any easy solution to this?

  2. #2
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Make sure you have python-dev installed.

    This should work otherwise: (you need an account to see links)

  3. The Following User Says Thank You to Zachafer For This Useful Post:

    DarkByte (12-07-2012)

  4. #3

    Joined
    Jun 2012
    Posts
    1,699
    Thanks
    876
    Thanked
    2,881/1,142
    DL/UL
    44/1
    Mentioned
    562 times
    Time Online
    118d 6h 45m
    Avg. Time Online
    40m
    Thanks with a little more digging with the info you posted I got it!


    /root$ sh setuptools-0.6c11-py2.7.egg
    Processing setuptools-0.6c11-py2.7.egg
    Copying setuptools-0.6c11-py2.7.egg to /usr/local/lib/python2.7/site-packages
    Adding setuptools 0.6c11 to easy-install.pth file
    Installing easy_install script to /usr/local/bin
    Installing easy_install-2.7 script to /usr/local/bin

    Installed /usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
    Processing dependencies for setuptools==0.6c11
    Finished processing dependencies for setuptools==0.6c11
    /root$ easy_install mysql-python
    Searching for mysql-python
    Reading (you need an account to see links)
    Reading (you need an account to see links)
    Reading (you need an account to see links)
    Best match: MySQL-python 1.2.4c1
    Downloading (you need an account to see links)
    Downloading (you need an account to see links)
    Processing MySQL-python-1.2.4c1.zip
    Running MySQL-python-1.2.4c1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-dxDCyG/MySQL-python-1.2.4c1/egg-dist-tmp-ZGj_rN
    Extracting in /tmp/easy_install-dxDCyG/MySQL-python-1.2.4c1/temp/tmpre4Uzo
    Now working in /tmp/easy_install-dxDCyG/MySQL-python-1.2.4c1/temp/tmpre4Uzo/distribute-0.6.28
    Building a Distribute egg in /tmp/easy_install-dxDCyG/MySQL-python-1.2.4c1
    /tmp/easy_install-dxDCyG/MySQL-python-1.2.4c1/distribute-0.6.28-py2.7.egg
    zip_safe flag not set; analyzing archive contents...
    Adding MySQL-python 1.2.4c1 to easy-install.pth file

    Installed /usr/local/lib/python2.7/site-packages/MySQL_python-1.2.4c1-py2.7-linux-x86_64.egg
    Processing dependencies for mysql-python
    Finished processing dependencies for mysql-python


    I had to update the python .egg fiile used for easy install for a 2.7.egg , done that and.....


    Last edited by DarkByte; 12-07-2012 at 07:12 AM.

  5. #4
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Good work!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •