Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7517909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:36:02+00:00 2026-05-30T01:36:02+00:00

Not sure how to explain it and can’t seem to figure out why this

  • 0

Not sure how to explain it and can’t seem to figure out why this is happening but I tried to install ‘MySQLdb’ from macports.

When I type ‘python’ and import MySQLdb, then it fails but when I launch python from /opt/local/bin/python2.7 and do the same then it works perfectly. I thought I’d be smart and see where the default python is pointing to and then point it to this one but thats when it starts getting strange.

$ which python
/opt/local/bin/python

$ ls -l /opt/local/bin/python
lrwxr-xr-x  1 root  admin  24 Feb 13 13:55 /opt/local/bin/python -> /opt/local/bin/python2.7

I don’t understand, it seems to be pointing the the one that works but I can’t load the same module as I can when I open python with the full path.

I’m sure I’m doing something dumb, so any help to explain why this is happening would be great.

Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "MySQLdb/__init__.py", line 19, in <module>
    import _mysql
ImportError: No module named _mysql
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:36:03+00:00Added an answer on May 30, 2026 at 1:36 am

    The Python version banner you show is from yet another Python, that of the python.org 2.7.2 64-bit/32-bit installer downloaded from python.org. It is not a MacPorts Python. There should be a symlink to it at /usr/local/bin/python2.7. Apparently, the PATH environment variable in the terminal session you are using is not what you think it is or possibly you have a shell alias defined. Try:

    echo $PATH
    

    You need to ensure that the MacPorts Python directory (/opt/local/bin) comes before that of the python.org Python (/Library/Frameworks/Python.frameworks/Version/2.7/bin or /usr/local/bin).

    UPDATE: Also check the current value of the MacPorts port select command. It may be pointing at a non MacPorts Python.

    $ sudo port select --list python
    Available versions for python:
        none
        python25-apple
        python26-apple
        python27 (active)
        python27-apple
        python32
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure if I can explain this correctly, but I am trying to execute
I'm not really sure how I can explain this, but here goes: I want
I'm not sure how to explain this but this piece of code bellow can
Pardon the excessive amount of code, but I'm not sure if I can explain
Not even sure how to explain this but I connect to a remote computer
Sorry for the vague title, but I'm not exactly sure how I can explain
I'm not sure if I can explain this clearly. I have some simple HTML
Having a problem , can't explain because not sure what is happening. Just can
I am not sure if the term Wildcard can explain my point, but sometimes
I'm not sure exactly how to explain this, so I'll just start with an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.