import _sqlite3 no module named error

Ned Deily nad at
Thu Jun 4 22:31:12 EDT 2009

In article 
<77e831100906041718k4b4f54d9v29729449c50f3cb at>,
 Vincent Davis <vincent at> wrote:
> On Thu, Jun 4, 2009 at 1:41 PM, Ned Deily <nad at> wrote:
> > $ /opt/local/bin/python2.5
> > Python 2.5.4 (r254:67916, May  4 2009, 01:40:08)
> > [GCC 4.0.1 (Apple Inc. build 5490)] on darwin
> > Type "help", "copyright", "credits" or "license" for more information.
> >>>> from _sqlite3 import *
> >>>>
> Also 10.5.7 my self, I have completely removed and reinstall macport
> and all the ports. All befor posting this thread...
> here is what i get, jhgfjhgfjhg it is working now, I have no clue. I
> went on a bike ride and now it works? Thanks for you help.

Good.  Wish I could claim to have magic powers that made it all work.

> What do you know about python_select, .bash_profile and .profile?

python_select is a shell script to manage multiple versions of 
MacPorts-supplied pythons.  MacPorts allows you to install multiple 
versions of python, say python2.4 and python2.5.  With python_select, 
you can select which version will be invoked by default, i.e. by 
/opt/local/bin/python.  It does this by creating the proper symlinks 
within /opt/local which is the directory sub-tree containing  
MacPorts-installed files.   There is more information in its man page. 

Things get even more complicated with pythons, each 
version of which has its own bin directory within a framework and which 
may have symlinks to it from /usr/local/bin.

.bash_profile and .profile are two of the various startup files read by 
the various shells out there.  In general, when dealing with multiple 
versions of the same command name, you can add commands to the 
appropriate shell startup files to modify the value of the PATH 
environment variable, which is what specifies the search path for 
commands.  For example, if /opt/local/bin comes before /usr/bin in 
$PATH, the command "python" will invoke the MacPorts default python 
rather than the Apple-supplied python.  PATH and shell startup files are 
all garden-variety Unix-y topics; there is plenty of info about them out 
there on the web.

Another way to deal with multiple versions is to avoid ambiguity by 
always specifying the absolute path to the desired python, as in my 
earlier example above.  There are other tactics, too, like defining 
shell aliases.  Of course, each approach has its pluses and minuses.

Hope that helps.

 Ned Deily,
 nad at

More information about the Python-list mailing list