Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #86241 > unrolled thread

Re: Python shell: Arrow keys not working in PuTTY

Started byLaura Creighton <lac@openend.se>
First post2015-02-23 18:20 +0100
Last post2015-02-25 00:39 -0800
Articles 7 — 4 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Python shell: Arrow keys not working in PuTTY Laura Creighton <lac@openend.se> - 2015-02-23 18:20 +0100
    Re: Python shell: Arrow keys not working in PuTTY Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-02-24 13:07 +1100
      Re: Python shell: Arrow keys not working in PuTTY Ned Deily <nad@acm.org> - 2015-02-23 18:35 -0800
        Re: Python shell: Arrow keys not working in PuTTY Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-02-24 16:59 +1100
          RE: Python shell: Arrow keys not working in PuTTY David Aldrich <David.Aldrich@EMEA.NEC.COM> - 2015-02-24 11:18 +0000
          Re: Python shell: Arrow keys not working in PuTTY Laura Creighton <lac@openend.se> - 2015-02-24 15:51 +0100
          Re: Python shell: Arrow keys not working in PuTTY Ned Deily <nad@acm.org> - 2015-02-25 00:39 -0800

#86241 — Re: Python shell: Arrow keys not working in PuTTY

FromLaura Creighton <lac@openend.se>
Date2015-02-23 18:20 +0100
SubjectRe: Python shell: Arrow keys not working in PuTTY
Message-ID<mailman.19085.1424712044.18130.python-list@python.org>
DO NOT REBUILD PYTHON ON CENTOS!

It can break the whole package management system
which depends on having a particular version of python installed.

If you are running Centos you need to use virtualenv to be safe.

Laura

[toc] | [next] | [standalone]


#86286

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2015-02-24 13:07 +1100
Message-ID<54ebdcfa$0$11100$c3e8da3@news.astraweb.com>
In reply to#86241
Laura Creighton wrote:

> DO NOT REBUILD PYTHON ON CENTOS!
> 
> It can break the whole package management system
> which depends on having a particular version of python installed.
> 
> If you are running Centos you need to use virtualenv to be safe.
> 
> Laura


Almost right!

You can install Python from source. Unzip the source tar ball, cd into the 
source directory, and run:

./configure
make

BUT do *not* run `make install` as that will overwrite your system Python 
and Bad Things will happen. Instead, run `make altinstall`.

Now you will have two Python installs, the stock-standard system Python is 
available as "python", and the newly-installed one as "pythonX.Y" (for 
version X.Y).

What I do is then add

alias python /usr/local/bin/pythonX.Y

to my .bashrc file, and use the new one. (Don't forget to change the X.Y to 
whatever version you actually used.)

What if you accidentally blow away the system Python by running `make 
install`? You probably won't be able to use yum to fix it, since yum relies 
on the system Python. Fortunately, you haven't actually *removed* the system 
Python, it's still there just hiding. First, find out which version of 
Python your system Python is:


[steve@ando ~]$ ls -l /usr/bin/python*
-rwxr-xr-x 2 root root 5708 Jan  9  2013 /usr/bin/python
lrwxrwxrwx 1 root root    6 Jan 22  2013 /usr/bin/python2 -> python
-rwxr-xr-x 2 root root 5708 Jan  9  2013 /usr/bin/python2.4

This tells me that the system Python is 2.4 (well actually I already knew 
that). /usr/bin/python here is a hard-link to the python2.4 executable. If I 
had accidentally killed the system Python, I would see something like:

-rwxr-xr-x 2 root root 6789 Feb 24  2015 /usr/bin/python
lrwxrwxrwx 1 root root    6 Jan 22  2013 /usr/bin/python2 -> python
-rwxr-xr-x 1 root root 5708 Jan  9  2013 /usr/bin/python2.4
-rwxr-xr-x 2 root root 6789 Feb 24  2015 /usr/bin/python2.7

The /usr/bin/python is now hard-linked to the newly installed version. As 
root:

rm /usr/bin/python  # Die, imposter!
ln /usr/bin/python2.4 /usr/bin/python  # Revive the system Python.

All fixed!


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#86289

FromNed Deily <nad@acm.org>
Date2015-02-23 18:35 -0800
Message-ID<mailman.19114.1424745346.18130.python-list@python.org>
In reply to#86286
In article <54ebdcfa$0$11100$c3e8da3@news.astraweb.com>,
 Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:
> Almost right!
> 
> You can install Python from source. Unzip the source tar ball, cd into the 
> source directory, and run:
> 
> ./configure
> make
> 
> BUT do *not* run `make install` as that will overwrite your system Python 
> and Bad Things will happen. Instead, run `make altinstall`.

With no --prefix= on ./configure, the default install location is to 
/usr/local, so "make install" would install a link at 
/usr/local/bin/python (or python3) and it would only overwrite your 
system Python if the system Python happened to be installed in 
/usr/local/bin/.

-- 
 Ned Deily,
 nad@acm.org

[toc] | [prev] | [next] | [standalone]


#86298

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2015-02-24 16:59 +1100
Message-ID<54ec1360$0$12978$c3e8da3$5496439d@news.astraweb.com>
In reply to#86289
Ned Deily wrote:

> In article <54ebdcfa$0$11100$c3e8da3@news.astraweb.com>,
>  Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:
>> Almost right!
>> 
>> You can install Python from source. Unzip the source tar ball, cd into
>> the source directory, and run:
>> 
>> ./configure
>> make
>> 
>> BUT do *not* run `make install` as that will overwrite your system Python
>> and Bad Things will happen. Instead, run `make altinstall`.
> 
> With no --prefix= on ./configure, the default install location is to
> /usr/local, so "make install" would install a link at
> /usr/local/bin/python (or python3) and it would only overwrite your
> system Python if the system Python happened to be installed in
> /usr/local/bin/.


Well, I'm not going to say you are wrong, but I can say that on Centos 5 
systems (and presumably that includes Fedora and Red Hat of the equivalent 
vintage), if you just run `make install` it overwrites the /usr/bin/python 
hard link to /usr/bin/python2.4. I know because I've done it :-( 



-- 
Steve

[toc] | [prev] | [next] | [standalone]


#86315

FromDavid Aldrich <David.Aldrich@EMEA.NEC.COM>
Date2015-02-24 11:18 +0000
Message-ID<mailman.19125.1424776732.18130.python-list@python.org>
In reply to#86298
> >> BUT do *not* run `make install` as that will overwrite your system
> >> Python and Bad Things will happen. Instead, run `make altinstall`.

Thanks for all the warnings. We did use `make altinstall`, so all is ok.

Recompiling, with readline installed, fixed the arrow keys.

[toc] | [prev] | [next] | [standalone]


#86319

FromLaura Creighton <lac@openend.se>
Date2015-02-24 15:51 +0100
Message-ID<mailman.19129.1424789509.18130.python-list@python.org>
In reply to#86298
In a message of Tue, 24 Feb 2015 11:18:38 +0000, David Aldrich writes:
>> >> BUT do *not* run `make install` as that will overwrite your system
>> >> Python and Bad Things will happen. Instead, run `make altinstall`.
>
>Thanks for all the warnings. We did use `make altinstall`, so all is ok.
>
>Recompiling, with readline installed, fixed the arrow keys.

Great!  Thank you for letting us know.

Laura (who was worried)

[toc] | [prev] | [next] | [standalone]


#86387

FromNed Deily <nad@acm.org>
Date2015-02-25 00:39 -0800
Message-ID<mailman.19175.1424853612.18130.python-list@python.org>
In reply to#86298
In article <54ec1360$0$12978$c3e8da3$5496439d@news.astraweb.com>,
 Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:
> Ned Deily wrote:
> > With no --prefix= on ./configure, the default install location is to
> > /usr/local, so "make install" would install a link at
> > /usr/local/bin/python (or python3) and it would only overwrite your
> > system Python if the system Python happened to be installed in
> > /usr/local/bin/.
> Well, I'm not going to say you are wrong, but I can say that on Centos 5 
> systems (and presumably that includes Fedora and Red Hat of the equivalent 
> vintage), if you just run `make install` it overwrites the /usr/bin/python 
> hard link to /usr/bin/python2.4. I know because I've done it :-(

If you're using any current 2.7.x or 3.4.x source tarball (or dev repo) 
from python.org, it ain't gonna happen.  (I'm not going to go back and 
check all the previous releases but it's been that way for a long time, 
AFAIK.)  If you're using source modified by a distribution, like Centos, 
RH, or Fedora, all bets are off, of course.

-- 
 Ned Deily,
 nad@acm.org

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web