10

I am running an Ubuntu 8.10, using Python 2.5 out of the box. This is fine from the system point of view, but I need Python2.4 since I dev on Zope / Plone.

Well, installing python2.4 is no challenge, but I can't find a (clean) way to make iPython use it : no option in the man nor in the config file.

Before, there was a ipython2.4 package but it is deprecated.

6 Answers 6

11

Ok, I answer my own question : I'm dumb :-)

ls /usr/bin/ipython*
/usr/bin/ipython  /usr/bin/ipython2.4  /usr/bin/ipython2.5

Now it's built-in...

Sign up to request clarification or add additional context in comments.

1 Comment

I wish there is a commandline flag to specify the python interpretter path
4

I'm using Ubuntu 10.10 and there's only on ipython installed. (There's also only one python available, but I got an older version with the deadsnakes ppa.)

To get ipython2.5, I installed ipython from your virtualenv:

virtualenv --python=/usr/bin/python2.5 project_name
source project_name/bin/activate
pip install ipython

Then the ipython version should match the python passed into virtualenv with --python.

Comments

1

I find the simplest way to specify which python version to use is to explicitly call the ipython script using that version. To do this, you may need to know the path to the ipython script, which you can find by running which ipython. Then simply run python <path-to-ipython> to start ipython.

Comments

0

You can just:

$ python2.4 setup.py install --prefix=$HOME/usr
$ python2.5 setup.py install --prefix=$HOME/usr

or

alias ip4 "python2.4 $HOME/usr/bin/ipython"
alias ip5 "python2.5 $HOME/usr/bin/ipython"

fyi

Comments

0

Actually you can run the ipython with the python version you like:

python2.7 ipython
python3 ipython

This is easiest solution for me and avoids virtual env setup for one-shot trials.

Comments

0

To complement on @Peter's answer, I might add that the ipython "executable" you run are simply python script that launch the ipython shell. So a solution that worked for me was to change the python version that runs that script:

$ cp ipython ipython3
$ nano ipython3

Here is what the script looks like:

#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from IPython import start_ipython
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(start_ipython())

You can now replace this first line with your correct version of python, for example, you may wan to use python 3:

$ which python3
/usr/bin/python3

so you would simply replace /usr/bin/python by /usr/bin/python3 in your newly created ipython3 file!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.