0

System: Ubuntu 12.04 (precise)

If I install scikit-learn through

sudo apt-get install python-sklearn 

I can import sklearn in python but get version 0.10, which I do not want

If I install scikit-learn through

sudo pip install -U scikit-learn

I can see the scikit_learn-0.14.1-py2.7.egg-info under /usr/local/lib/python2.7/dist-packages/ but I don't know how to get python to import the correct version. Setting PYTHONPATH to /usr/local/lib/python2.7/dist-packages/ did not help.

How do I get python to load the modules from where pip puts them, not where apt-get install puts them?

user1256124
  • 109
  • 1
  • 5
  • This may help: http://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory – Rob Parker Mar 28 '14 at 23:39
  • I heartily recommend [anaconda](http://docs.continuum.io/anaconda/), it'll manage all this for you. – Andy Hayden Mar 29 '14 at 00:09

2 Answers2

1

You can set the site dir in your code.

import site
site.addsitedir('/usr/local/lib/python2.7/dist-packages')
Rob Parker
  • 503
  • 4
  • 10
1

It might be the case that you have several versions of python installed and the pip command in your PATH is not matching the python command in your path. You can check with:

which python
which pip
cat `which pip`
ogrisel
  • 39,309
  • 12
  • 116
  • 125