I have both python2.7
and python3.2
installed in Ubuntu 12.04
.
The symbolic link python
links to python2.7
You should install ALL dependencies:
sudo apt-get install build-essential python3-dev python3-setuptools python3-numpy python3-scipy libatlas-dev libatlas3gf-base
Install pip3(if you have installed, please look step 3):
sudo apt-get install python3-pip
Iinstall scikit-learn by pip3
pip3 install -U scikit-learn
Open your terminal and entry python3 environment, type import sklearn
to check it.
Gook Luck!
You may want to build a virtualenv
of python3, then install packages of python3 after activating the virtualenv. So your system won't be messed up :)
This could be something like:
virtualenv -p /usr/bin/python3 py3env
source py3env/bin/activate
pip install package-name
Old question, but none of the answers satisfies me. One of my systems is running Ubuntu 12.04 LTS and for some reason there's no package python3-pip
or python-pip
for Python 3. So here is what I've done (all commands were executed as root):
Install setuptools
for Python3 in case you haven't.
apt-get install python3-setuptools
or
aptitude install python3-setuptools
With Python 2.4+ you can invoke easy_install
with specific Python version by using python -m easy_install
. So pip
for Python 3 could be installed by:
python3 -m easy_install pip
That's it, you got pip
for Python 3. Now just invoke pip
with the specific version of Python to install package for Python 3. For example, with Python 3.2 installed on my system, I used:
pip-3.2 install [package]
To install pip for python3 use should use pip3 instead of pip. To install python in ubuntu 18.08 bionic
sudo apt-get install python3.7
To install the required pip package in ubuntu
sudo apt-get install python3-pip
Firstly, you need to install pip for the Python 3 installation that you want. Then you run that pip to install packages for that Python version.
Since you have both pip and python 3 in /usr/bin, I assume they are both installed with a package manager of some sort. That package manager should also have a Python 3 pip. That's the one you should install.
Felix' recommendation of virtualenv is a good one. If you are only testing, or you are doing development, then you shouldn't install the package in the system python. Using virtualenv, or even building your own Pythons for development, is better in those cases.
But if you actually do want to install this package in the system python, installing pip for Python 3 is the way to go.