如何在Windows中安装whois Python模块
我想在Windows上安装whois这个Python模块。
我试着用命令来安装whois模块。python setup.py install
我从这里下载的:
https://pypi.python.org/pypi/pythonwhois
但是当我尝试导入whois模块时,它却报错了。
>>> import whois
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import whois
ImportError: No module named whois
提前谢谢你们!
2 个回答
1
试着使用 pip - http://pip.readthedocs.org/en/latest/installing.html,下载文件,运行脚本,然后你可以这样做 - http://www.pythonforbeginners.com/dns/using-pywhois,使用命令 pip install python-whois。
2
我建议你先安装pip。你可以参考这个链接了解如何在Windows上安装:http://docs.python-guide.org/en/latest/starting/install/win/,或者查看这个问题:如何在Windows上安装pip?
安装完pip后,打开命令提示符,直接输入:
pip install whois
这样就可以了。
更新:还有其他方法安装whois吗?
第一步:安装完Python后,记得把以下内容添加到环境变量的PATH里。
C:\Python27\;C:\Python27\Scripts\
第二步:下载这个文件ez_setup.py。运行它,它会帮你安装Setuptools。
第三步:打开命令行/PowerShell
,输入:
easy_install whois
第四步:完成了!去Python里输入import whois
就可以使用了。