Home  >  Article  >  Backend Development  >  How to Install Python3 Packages Using Pip on Ubuntu?

How to Install Python3 Packages Using Pip on Ubuntu?

DDD
DDDOriginal
2024-11-02 19:44:03224browse

How to Install Python3 Packages Using Pip on Ubuntu?

Installing Python3 Versions of Packages Using Pip on Ubuntu

When running 'sudo pip install package-name' in an environment with multiple Python versions, it can default to installing the Python2 version. To install the Python3 version, here's a solution for Ubuntu 12.04 without using wget or virtualenvs:

  1. Install python3-setuptools: Run 'sudo aptitude install python3-setuptools' to obtain the 'easy_install3' command.
  2. Install pip using Python 3's setuptools: Run 'sudo easy_install3 pip' to install pip-3.2.
  3. Install packages with pip-3.2: Use 'sudo pip-3.2 install ' to install packages for your base system, which requires root privileges.

For Ubuntu 12.10 and Fedora 13 , installing python3-pip will provide pip-3.2 or later versions without the need for these steps.

The above is the detailed content of How to Install Python3 Packages Using Pip on Ubuntu?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn