How to install python3 version of package via pip on Ubuntu?

前端 未结 17 2040
粉色の甜心
粉色の甜心 2020-11-22 11:03

I have both python2.7 and python3.2 installed in Ubuntu 12.04.
The symbolic link python links to python2.7

17条回答
  •  无人共我
    2020-11-22 11:39

    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]
      

提交回复
热议问题