Installing python modules for specific version on

2019-06-10 03:32发布

问题:

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

回答1:

Try working in a virtual environment with virtualenv. This will keep your python versions/packages separate from each other in case something goes wrong. Use pip to install PySide.

EDIT:

A possible solution is:

~$ sudo easy_install pip

To install virtualenv,

~$ sudo pip install virtualenv

The page for PySide on PyPi has a guide for different platforms on how to install pyqt with virtualenv. Best of luck.



回答2:

I think you should install the pyside from its source files that have setup.py and then run the command python3.3 setup.py build and sudo python3.3 setup.py install because if you install by apt for example, it will use the default interpreter which is 3.2 that you mentioned.