Fwd: Syntax error

Terry Reedy tjreedy at udel.edu
Sat Feb 3 17:28:48 EST 2018


On 2/3/2018 3:38 PM, bob gailer wrote:
> On 2/3/2018 2:40 PM, Terry Reedy wrote:
>> On 2/3/2018 2:10 PM, Kevin Doney wrote:
>>> Hi.
>>>
>>> *pip3 install --upgrade tensorflow-gpu*
>>>
>>> When I try the above command I get
>>> SyntaxError: invalid syntax
>>>
>>>
>>> Please help.
>>
>> This group helps those who help the group -- by asking questions with 
>> sufficient information to answer.  Post the ENTIRE trackback.
> It also helps us to know:
> operating system (e.g., windows 10)
> what does "when I try" mean? (e.g. at a windows command prompt I entered 
> ...)
> What the *'s are for
> best is to copy the entire session and paste it into your email. Example

I entirely agree.

> Microsoft Windows [Version 10.0.16299.192]
> (c) 2017 Microsoft Corporation. All rights reserved.
> 
> C:\Users\bgailer>pip install foo
> Collecting foo
>    Could not find a version that satisfies the requirement foo (from 
> versions: )
> No matching distribution found for foo
> 
> We could presume in your case that you tried to enter your pip command 
> in a python interactive session.

This is a good guess, and I hope it is correct, because the alternative 
of a SyntaxError in some execution path in pip or dependency or python 
stdlib module or package being installed is worse.

> For example:
> 
> C:\Users\bgailer>python
> Python 3.3.5 (v3.3.5:62cf4e77f785, Mar  9 2014, 10:35:05) [MSC v.1600 64 
> bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> pip install foo
>    File "<stdin>", line 1
>      pip install foo
>                ^
> SyntaxError: invalid syntax
>  >>>
> 
> Why did you get that response? Because pip is not a python statement 
> (python does not have commands); it is an executable program. So you 
> need to use a command prompt or terminal.
> 
> 


-- 
Terry Jan Reedy





More information about the Python-list mailing list