On 3/11/2018 2:08 PM, GISDude wrote:
On Saturday, March 10, 2018 at 10:28:00 AM UTC-8, Terry Reedy wrote:


Why can't I use pip while in IDLE

Would you expect to use pip in MS Excel?  If you type 'python' at a
command line, and get the '>>>' REPL prompt (google REPL), then your
input goes to the python interpreter, which only accepts python
statements.  The same is true in the IDLE Shell, and when you run python
code in the editor.

[Some 3rd party IDEs have a front end for PIP. I wanted to add this for
IDLE but the project was vetoed when partly done.]

What one can do in any Python REPL or program is to use subprocess to call pip. I used something like the following, recently, to prove it could be done, to install numpy from IDLE shell on Windows.

>>> import subprocess as sub
>>> sub.run("pip install numpy", stdout=sub.PIPE, stderr=sub.STDOUT).stdout

But since I have Command Prompt pinned to the taskbar and often open, there is no point to this extra typing for me.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to