[Python-ideas] install pip packages from Python prompt

Steve Barnes gadgetsteve at live.co.uk
Tue Oct 31 15:31:56 EDT 2017



On 31/10/2017 18:05, Chris Angelico wrote:
> On Wed, Nov 1, 2017 at 2:49 AM, Chris Barker <chris.barker at noaa.gov> wrote:
>> And sure, some of those are completly clueless about what a command line is
>> and how to use it, but others DO have an idea about the command line, but
>> dont know that:
>>
>>>>> pip install something
>>    File "<stdin>", line 1
>>      pip install something
>>                ^
>> SyntaxError: invalid syntax
>>
>> means: "this was supposed to be run at the command prompt"
>>
>> So I think defining a "pip" builtin that simply gave a helpful message would
>> be a good start.
>>
>> (hmm, it's a syntax error, so not as simple as a builtin -- but it could be
>> caught somehow to give a better message)
> 
> This sounds like the job for an enhanced REPL like Jupyter/ipython. In
> fact, it might already exist - I haven't looked.
> 
> ChrisA

Of course those in environments where they need to avoid the use of the 
shell could use ipython and simply start the session with:

  !pip install -U needed_package

before doing any imports.

-- 
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect 
those of my employer.

---
This email has been checked for viruses by AVG.
http://www.avg.com



More information about the Python-ideas mailing list