Python structure help in * nixes

I came from a Windows background that comes with a development environment. I'm used to running an .exe from whatever I need to run and just forget.

I usually code in php, javascript, css, html and python.

I now have to use Linux at my work in unchanging Ubuntu 8.04, with permissions to update my system using company repositories.

I need to install Python 2.4.3 to start coding on an old legacy system. I had Python 2.5. I downloaded Python 2.4.3 tar files, executed. / configure make etc. Everything worked, but now the default installation - my system is Python2.4 instead of Python2.5.

I need help from you to change it, and if possible some material to read about symbolic links, multiple Python installations, virtualenvs, etc: everything I need to know before installing / updating Python modules. I installed for example the ElementTree package and don't even know which Python installation it was installed in.

Thanks in advance!

+2


a source to share


5 answers


If you have root access, you can simply create a new link.

sudo mv /usr/bin/python /usr/bin/python2.4
sudo ln -s /usr/bin/python25 /usr/bin/python

      



I don't have too much experience with ubuntu, but I think it shouldn't slow down.

To learn more about ln

, read on man ln

.

+1


a source


You may have installed Python 2.4 in /usr/local/bin

, which in turn may appear in your $PATH

pre /usr/bin

, where 2.5 lives. There are various possible fixes if this is the case: the simplest one probably refers to a rm

named link /usr/local/bin/python

(leaving only the "system" version named /usr/bin/python

). You will then need to explicitly specify python2.4

to invoke the 2.4 installation, but python

will only switch to the Python 2.5 installed system.



+2


a source


For which version of Python to run when the command is invoked python

, you will have to manually change the symbolic link it points to /usr/bin/python

, but this will not change what the packaging system considers "standard Python" and means you still have to install the version-specific libraries if they differ for a specific version. Fortunately, these packages have a simple naming convention, not just python-<foo>

these python2.4-<foo>

, and installing them will put them in the correct path (specifically the directory on the right site-packages

).

EDIT : apparently python

not managed by alternatives system, silly Debian / Ubuntu

+1


a source


Running

 sudo apt-get install --reinstall python-minimal python python2.5

      

should restore default Python installation.

Unlike Windows, Ubuntu comes with quite a lot of distributor-supplied software, and it's a good idea to stay with these packages if possible instead of downloading the software from the net. Ubuntu 8.04 has Python 2.4.5 (python2.4 package), maybe this works for you.

If you need to install Python from source use

 ./configure --prefix=/usr/local/

      

instead of simple. / configure. This makes python to install in / usr / local / so it doesn't overwrite distribution files

+1


a source


Disabling @rebus:

sudo ln -s /usr/bin/python2.5 /usr/bin/python

      

Seems to have worked.

0


a source







All Articles