Python 新手 - PIP / 无效语法错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16314589/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Python newbie - PIP / invalid syntax error
提问by user2338676
Ok, totally newbie to programming and python. Running Windows 7, python 2.7 x64.
I am trying in install dateutilpackage using pip.
好的,完全是编程和 python 的新手。运行 Windows 7,python 2.7 x64。我正在尝试dateutil使用pip.
I installed pip, numpyand pandas... which were pretty straightforward as they are exefiles.
我安装了pip,numpy和pandas... 这很简单,因为它们是exe文件。
I am now trying to use pipto install dateutil. In the Python Shell, I have typed:
我现在正在尝试使用pip安装dateutil. 在 Python Shell 中,我输入了:
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.
我继续"Invalid Syntax"在安装命令中收到错误。我在这里做错了什么?我也在 python 命令行中尝试过这个。
I have checked my modules installed and I have both pipand easy_install. Really confused right now...I also have tried running the setup script for dateutiland I get this error:
我已经检查了我安装的模块,并且我有pip和easy_install. 现在真的很困惑......我也试过运行安装脚本dateutil,但我收到了这个错误:
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.
请帮忙!在此先感谢您的帮助。
回答by Daniel Roseman
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).
你不用在 Python shell 中输入它。您在命令提示符下键入它(多年未使用 Windows,但它曾经被称为cmd)。
回答by Sameer H. Ibra
you can use :
您可以使用 :
easy_install
by download setuptoolseasy way to download any Python packages
通过下载setuptools下载任何 Python 包的简单方法

