[Distutils] PIP not recognized in python shell

Wes Turner wes.turner at gmail.com
Wed Oct 4 09:58:04 EDT 2017


With IPython:

!pip install -U pip

Or, with Python:

>> subprocess.check_call(['./pip', 'install'])
>> subprocess.check_call('pip install', shell=True) #*

https://docs.python.org/3/library/subprocess.html#security-considerations

... http://sarge.readthedocs.io/en/latest/tutorial.html

On Wednesday, October 4, 2017, Nick Coghlan <ncoghlan at gmail.com> wrote:

> On 4 October 2017 at 05:27, Milind Rangnekar <milindha at gmail.com
> <javascript:;>> wrote:
> >  However, PIP is  not recognized in Python 3.4.3 Shell.
> >
> >>>> pip install
> > SyntaxError: invalid syntax
> >>>> pip
> > Traceback (most recent call last):
> >   File "<pyshell#11>", line 1, in <module>
> >     pip
> > NameError: name 'pip' is not defined
> >>>> python -m pip install beautifulsoup4
> > SyntaxError: invalid syntax
>
> This is expected behaviour, as the Python REPL is for running Python
> code, not for running command line executables.
>
> "pip" and "python" don't work in the Python REPL for the same reason
> that attempting to run "dir", "cd" or "systeminfo" doesn't work -
> they're shell commands rather than Python code.
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan   |   ncoghlan at gmail.com <javascript:;>   |   Brisbane,
> Australia
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org <javascript:;>
> https://mail.python.org/mailman/listinfo/distutils-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20171004/32c29ece/attachment-0001.html>


More information about the Distutils-SIG mailing list