pip missing from Python venv

2019-07-27 21:55发布

问题:

When I create a new virtualenv using python3.5, it creates the virtualenv using Python 3.5.2 as expected, but is missing pip:

jpmelos@jpmelos-laptop:~$ pi<TAB COMPLETION>
pi1toppm         pilconvert       pinentry         ping6
pi3topbm         pildriver        pinentry-curses  pinky
pic              pilfile          pinentry-gnome3  pip3.6
piconv           pilfont          pinentry-x11     pivot_root
pidof            pilprint         ping             pixeltool
jpmelos@jpmelos-laptop:~$ python3.5 -m venv myvenv
jpmelos@jpmelos-laptop:~$ source myvenv/bin/activate
(myvenv) jpmelos@jpmelos-laptop:~$ pi<TAB COMPLETION>
pi1toppm         pilconvert       pinentry         ping6
pi3topbm         pildriver        pinentry-curses  pinky
pic              pilfile          pinentry-gnome3  pip3.6
piconv           pilfont          pinentry-x11     pivot_root
pidof            pilprint         ping             pixeltool
(myvenv) jpmelos@jpmelos-laptop:~$ python
Python 3.5.2 (default, Dec 28 2016, 10:08:00)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
(myvenv) jpmelos@jpmelos-laptop:~$

What is going on? Shouldn't there be a pip binary?

回答1:

Remove .pydistutils.cfg file in your home directory.

rm ~/.pydistutils.cfg

This is nicely explained in this.