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 <ncogh...@gmail.com> wrote:

> On 4 October 2017 at 05:27, Milind Rangnekar <milin...@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   |   ncogh...@gmail.com <javascript:;>   |   Brisbane,
> Australia
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG@python.org <javascript:;>
> https://mail.python.org/mailman/listinfo/distutils-sig
>
_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to