Ubuntu - python2 and python3 coexist - installing library

1.1k views Asked by At

I have a silly problem. I wrote a simple application in Python3. I was testing it on my local machine with Windows and Python3 only so when I installed psutil everything worked just fine. However when I've sent it to the target system with Ubuntu problems started. There two instances of python on this machine: 2.7 and 3.2.3. I tried to install psutil by sudo apt-get install python-psutil and it installed it just version 2.7. I also tried to use easy_install somehow but it claims it's already installed in p2.7. How can I get it running on python3??

1

There are 1 answers

0
Tomasz Kapłoński On BEST ANSWER

Ok, I found the solution. So to install psutil for python3 you should:

  1. Download psutil sources from http://code.google.com/p/psutil/downloads/list
  2. Extract tar file in some tmp directory
  3. Open terminal and go to this directory
  4. Type sudo apt-get install python3-dev
  5. Type python3 setup.py install

I believe that this approach would work fine also for other libraries when you have multiple pythons on the system. Hope someone will save some time :)