无法安装python-dateutil

时间:2015-11-25 04:54:12

标签: python python-2.7 powershell pip python-dateutil

我试图在堆栈上搜索相同的问题,但没有一个是有用和准确的。我试着安装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

我该怎么办?

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:1)

这样做:

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

2 - 打开新的命令提示符

3 - 输入pip install python-dateutil

完成!!