简体   繁体   中英

I have python3.4 but no pip or ensurepip.. is something wrong with my python3.4 version?

I've read in multiple places that python3.4 ships with pip. My OS is Lubuntu 14.04 and the default python version is Python 2.7.6 but in

/usr/bin

it says I have python3.4 installed (when I run python3 -V it says I have Python 3.4.0). I made this post earlier last week: How do I use pip 3 with Python 3.4?

One of the comments to the reply said that "It may be worth mentioning that python3.4 should always ship pip by default. So python3 -m pip should work out of the box. If not, there's python -m ensurepip to bootstrap pip. get-pip.py should not be necessary here."

I can confirm that I do not have pip because I did

pip -V

and it said that pip is currently not installed. I tried running

python3 -m pip

and it said

/usr/bin/python3: No module named pip

I then tried

python -m ensurepip
python3 -m ensurepip

and it said

/usr/bin/python: No module named ensurepip
/usr/bin/python3: No module named ensurepip

With that said, is there something wrong with my version of python3 because it does not have pip or ensurepip? I'm asking because I've read in multiple places (for example, in my previous question) that python3.4 comes with pip and I don't think that is true for my case.

My end goal is to run Django1.8 using python 3.4.3.

在 Ubuntu 和其他 Debian 衍生产品上,您必须安装python3-pip才能获得 Python3 的 pip。

apt-get install python3-pip

You can try below code for pip installation on Ubuntu.

sudo apt update
sudo apt install python3-pip

On Ubuntu Focal/20.04, got the same error

❯ python3 -m ensurepip --upgrade
/usr/bin/python3: No module named ensurepip

Disable for System Python

It looks like it's disable for system python as described by Python2 interpreter output:

❯ python2 -m ensurepip --upgrade
ensurepip is disabled in Debian/Ubuntu for the system python.

Python modules For the system python are usually handled by dpkg and apt-get.

    apt-get install python-<module name>

Install the python-pip package to use pip itself.  Using pip together
with the system python might have unexpected results for any system installed
module, so use it on your own risk, or make sure to only use it in virtual
environments.

Solution

Use apt to install it:

apt install python3-pip

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM