Python newbie - PIP / invalid syntax error [duplicate]
Asked Answered
T

2

14

Ok, totally newbie to programming and python. Running Windows 7, python 2.7 x64. I am trying in install dateutil package using pip.

I installed pip, numpy and pandas... which were pretty straightforward as they are exe files.

I am now trying to use pip to install dateutil. In the Python Shell, I have typed:

pip install dateutil 

and

pip install python-dateutil

I continue to get "Invalid Syntax" errors at the install command. What am I doing wrong here? I have also tried this in the python command line.

I have checked my modules installed and I have both pip and easy_install. Really confused right now...I also have tried running the setup script for dateutil and I get this error:

Traceback (most recent call last):
  File "C:\Python27\Scripts\python-dateutil-1.5.tar\python-dateutil-1.5\setup.py", line 14, in <module>
    TOPDIR = os.path.dirname(__file__) or "."
NameError: name '__file__' is not defined

Help please! Thanks in advance for any help.

Torbernite answered 1/5, 2013 at 7:53 Comment(3)
try using command prompt instead of the python shell :)Excogitate
I have also used the python command prompt C:\Python27\python.exe and I get a similar error. File "<stdin>", line 1 pip SyntaxError: invalid syntaxTorbernite
You don't need to start the python interpreter. Just launch the cmd and type pip install dateutil.Excogitate
J
15

You don't type that in the Python shell. You type it in the command prompt (haven't used Windows for years, but it used to be called cmd).

Jacaranda answered 1/5, 2013 at 8:41 Comment(2)
ahhh. the windows command prompt. got it and success. thanks for the quick reply!!Torbernite
@user2338676: if this answer solved your problem, you should mark this answer as accepted with clicking the green tick! Thanks!Foundry
W
0

you can use :

easy_install

by download setuptools easy way to download any Python packages

Wilber answered 1/5, 2013 at 8:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.