interactive terminal in Ubuntu Linux : libreadline5-dev works only in Python 2.6 not 3.1

casevh casevh at gmail.com
Sun Jan 10 01:48:52 CET 2010


On Jan 9, 3:10 pm, pdlem... at earthlink.net wrote:
> On Sat, 9 Jan 2010 13:27:07 -0800 (PST), casevh <cas... at gmail.com>
> wrote:
> >Did you recompile Python 3.1.1 after installing libreadline5-dev?
>
> >(From the Python 3.1.1 directory. Your options to configure may vary.)
>
> >make distclean
> >./configure --prefix=/usr/local --with-computed-gotos --with-wide-
> >unicode
> >make
> >make altinstall
>
> >casevh
>
> Thanks so much for your help . . . but I'm going backwards, probably
> due to my inadequate knowledge of Linux.
>
> Ran the above vebatim, except had to do      sudo make install    .
> Python recompiled and the system appears to be in same path/dir as
> before :  /home/dave/python31/Python-3.1.1
> Called up interactive prompt  >>>  with  $ python3 , as before.
>

It looks like you now have two copies of Python 3.1.1 installed.
That's probably a side-effect of my instructions. I'll got through
each instruction individually.

It looks like your Python source code is in "/home/dave/python31/
Python-3.1.1". The commnad "make distclean" should remove the results
of the prior configuration so to won't need to extract the source code
again.

The command "./configure" accepts several options that control how the
source code is configured. To see all the available options, use the
command "./configure --help". The first option - "--prefix=/usr/local"
- identifies the location where Python 3.1.1 will be installed. The "/
usr/local" directory is a common location for user-compiled programs.
If no location is specified, many applications assume "/usr/local".
The option - "--with-computed-gotos" - is just a compiler options that
produces a slightly faster interpreter. The final option - "--with-
wide-unicode" - identifies the proper Unicode format to use. (I looks
like this option may have been split via line wrapping on my earlier
email. I think it is causing the UCS4 error.)

The command "make" compiles Python 3.1.1.

The command "sudo make altinstall" installs Python 3.1.1 under the "/
usr/local" directory. The option "altinstall" installs Python 3.1.1
and leaves its name as "python3.1". It should be located in "/usr/
local/bin/python3.1".

Your own programs (Ackermann.py) should be kept somewhere in your home
directory, for example "/home/dave/code". Typing "python3.1" will look
in the current directory first, and then search the path where it
should find "/usr/local/bin/python3.1".

What will you need to do fix this?

1) Try the commands again. Make sure all the "./configure" options are
on one line. Make sure to do "sudo make altinstall". (Don't use "sudo
make install"; it will give your version of Python the name "python"
and that can cause confusion on your system.)

2) Move your applications to another directory.

3) Try running "python3.1" while you are in that directory.

If this doesn't work, report back on the error messages you receive.

Don't give up; we can fix this.

casevh
> Problems :
>     1. prompt keys remain fouled up as before.
>     2. will not import  random  module, either from prompt or
>             from any of my prewritten modules.  Get ImportError
>            /usr/local/lib/Python3.1/lib-dynload/_collections.so :
>             undefined symbol : PyUnicode UCS4_FromString
>                 Some other modules will import : math , sys, os
>     3. Some of my pre-existing modules will not run : have
>           not checked them all, but apparently those with random.
>     4. Attempted to read my modules with gedit.  Pulls them
>           up but refuses to save :          could not save file
>           /usr/local/lib/python3.1/dlmodules/Ackermann.py
>                You do not have permission necessary to save file.
>           This is same path my modules were in before the
>           recompile and the dir I made for them. Had no trouble
>           saving them previously.
>
> If no fix available, I'll reinstall from the Python-3.1.1 that
> I extracted from the tarball , and go back to XP for a while  : (
>
> Dave WB3DWE       pdlem... at earthlink.net




More information about the Python-list mailing list