无法安装 python-dateutil

Can't install python-dateutil

我试图在堆栈上搜索相同的问题,但 none 很有用且准确。我尝试安装 python-dateutil。我先用一种方法然后用另一种方法:

1) 我从 https://pypi.python.org/pypi/python-dateutil/ 下载了 python-dateutil-2.4.2.tar.gz 并尝试手动安装。没有成功,所以我将其解压到 :C\Python27\ 并在 PowerShell 中执行了以下操作:

PS C:\Python27\python-dateutil-2.4.2> python python-dateutil.py

它没有成功,我得到了这个:

PS C:\Python27\python-dateutil-2.4.2> python setup.py
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: no commands supplied

2) 我也从 https://pypi.python.org/pypi/python-dateutil/ 下载了 python_dateutil-2.4.2-py2.py3-none-any.whl .这次当然是作为轮文件。我把它放在 :C\Python27\ 而在 PowerShell 中我做了:

PS C:\Python27\python-dateutil-2.4.2> pip install python_dateutil-2.4.2-py2.py3-none-any.whl

同样,它没有成功,我得到了这个:

The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spellin
g of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:4
+ pip <<<<  install python_dateutil-2.4.2-py2.py3-none-any (1).whl
    + CategoryInfo          : ObjectNotFound: (pip:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我该怎么办?

  1. 安装python setup.py install
  2. pip 不在路径中。添加 C:\Python27\Scripts\ 到您的 %Path% 环境变量。见 How do I install pip on Windows?

这样做:

1 - 将 pip 安装目录添加到环境变量 PATH

2 - 打开新的命令提示符

3 - 输入 pip install python-dateutil

完成!!