Python newbie - PIP / invalid syntax error [duplicate]

こ雲淡風輕ζ 提交于 2019-11-29 11:57:13

问题


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.


回答1:


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).




回答2:


you can use :

easy_install

by download setuptools easy way to download any Python packages



来源:https://stackoverflow.com/questions/16314589/python-newbie-pip-invalid-syntax-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!