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