python - unable - upgrade pip windows
How to install python3 version of package via pip on Ubuntu? (11)
sudo apt-get install python3-pip sudo pip3 install MODULE_NAME
Source: Shashank Bharadwaj's comment
The short answer applies only on newer systems. On some versions of Ubuntu the command is
sudo pip-3.2 install MODULE_NAME
If it doesn't work, this method should work for any Linux distro and supported version:
sudo apt-get install curl curl https://bootstrap.pypa.io/get-pip.py | sudo python3 sudo pip3 install MODULE_NAME
If you don't have
wget. If you don't have
sudo, switch to
pip3 symlink does not exists, check for something like pip-3.X
Much python packages require also the dev package, so install it too:
sudo apt-get install python3-dev
Check also Tobu's answer if you want an even more upgraded version of Python.
I want to add that using a virtual environment is usually the preferred way to develop a python application, so @felixyan answer is probably the best in an ideal world. But if you really want to install that package globally, or if need to test / use it frequently without activating a virtual environment, I suppose installing it as a global package is the way to go.
I have both
python3.2 installed in
The symbolic link
python links to
When I type:
sudo pip install package-name
It will default install
python2 version of
Some package supports both
How to install
python3 version of
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 sklearnto check it.
Although the question relates to Ubuntu, let me contribute by saying that I'm on Mac and my
python command defaults to Python 2.7.5. I have Python 3 as well, accessible via
python3, so knowing the pip package origin, I just downloaded it and issued
sudo python3 setup.py install against it and, surely enough, only Python 3 has now this module inside its site packages. Hope this helps a wandering Mac-stranger.
Another way to install python3 is using wget. Below are the steps for installation.
wget http://www.python.org/ftp/python/3.3.5/Python-3.3.5.tar.xz tar xJf ./Python-3.3.5.tar.xz cd ./Python-3.3.5 ./configure --prefix=/opt/python3.3 make && sudo make install
Also,one can create an alias for the same using
echo 'alias py="/opt/python3.3/bin/python3.3"' >> ~/.bashrc
Now open a new terminal and type py and press Enter.
Execute the pip binary directly.
First locate the version of PIP you want.
jon-mint python3.3 # whereis ip ip: /bin/ip /sbin/ip /usr/share/man/man8/ip.8.gz /usr/share/man/man7/ip.7.gz
jon-mint python3.3 # pip3.3 install pexpect Downloading/unpacking pexpect Downloading pexpect-3.2.tar.gz (131kB): 131kB downloaded Running setup.py (path:/tmp/pip_build_root/pexpect/setup.py) egg_info for package pexpect Installing collected packages: pexpect Running setup.py install for pexpect Successfully installed pexpect Cleaning up...
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.
If you have pip installed in both pythons, and both are in your path, just use:
$ pip-2.7 install PACKAGENAME $ pip-3.2 install PACKAGENAME
This is a duplicate of question #2812520
If you just installed Python 3.3 and now want to install pip 3.3 locally:
wget http://python-distribute.org/distribute_setup.py python3.3 -m distribute_setup install --user easy_install-3.3 --user pip
This works in Ubuntu 12.04. Don't forget to add
$HOME/.local/bin to your path.
The easiest way to install latest
pip3 and corresponding packages:
curl https://bootstrap.pypa.io/get-pip.py | python2 pip2 install package-name curl https://bootstrap.pypa.io/get-pip.py | python3 pip3 install package-name
Note: please run these commands as
Well, on ubuntu 13.10/14.04, things are a little different.
$ sudo apt-get install python3-pip
$ sudo pip3 install packagename
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