我尝试在堆栈上搜索相同的问题,但没有一个是有帮助和精确的。我尝试安装 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
我该怎么办?
这样做
将pip安装目录添加到环境变量PATH中
打开新的命令提示符
类型
pip install python-dateutil
完成!
python setup.py install
pip
不在路径中。将 C:\Python27\Scripts\
添加到您的 %Path% 环境变量中。请参阅如何在 Windows 上安装 pip?