9

So, to keep it simple. Ubuntu 12.10 has python 3.2 pre installed and it is linked to "python3". I downloaded python 3.3 and it's command is "python3.3". However, I downloaded pySide for python3 from synaptic. Using "from PySide.QtCore import *" fails on python3.3. BUT, when I ran just "python3" (aka 3.2) everything works fine. Synaptic just installed lib for python3.2 which is default for python3 in ubuntu. How can I force synaptic to install modules for python3.3?

Thanks

3 Answers 3

4

You can custom your python3 alias. For this, you can modify your .bashrc file by appending "alias python3='python3.3'" at the end of it. This shell script can do it for you :

#!/bin/bash

cd ~

# Create the ~/.bashrc file if it does not exist
if [ ! -f ./.bashrc ]; then
    touch .bashrc
    chmod 755 .bashrc
    echo "#!/bin/bash" >> .bashrc
fi

# Append the customed alias
echo " " >> .bashrc
echo "alias python3='python3.3'" >> .bashrc
echo " " >> .bashrc

# Reload settings in the .bashrc script
source .bashrc
3
  • Thanks. This will make installing modules from synaptic to python3.3 dir, yes? Dec 16, 2012 at 9:34
  • 4
    Well, this indeed makes "python3" run "python3.3", but after installing python3 module from synaptic, it still installs only to python 3.2... There must be some magic with symlinks to 3.3 location. Dec 16, 2012 at 10:01
  • I'm having the same issue, trying to download packages but they default to the wrong installation
    – ssb
    Mar 14, 2013 at 11:35
1

You may run different python versions on the same system by setting up the appropriate environment variables. This would allow you to locally install a later version of Python than the synaptic package manager might offer. e.g. in a file (mysetup) have:

TK_LIBRARY=/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/site-packages/PIL:/usr/lib   
TKPATH=/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/site-packages/PIL:/usr/lib 
TCL_LIBRARY=/usr/lib 
export TCL_LIBRARY TK_LIBRARY TKKPATH   

export PYTHONPATH=/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-stdwin:/usr/lib/python2.7/lib-dynload:/usr/lib:.     

and put them into your environment with . mysetup

0

Looking at the file list for a pyside package, it appears that it's only been compiled for Python 3.2. You can either:

  • Use 3.2 for now. 3.3 will probably be available with 13.04.
  • Download the source code for pyside (use apt-get source pyside), and recompile it for Python 3.3.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .