我收到此错误消息
ModuleNotFoundError: No module named 'whois.whois' from https://pypi.org/project/python-whois/
https://pypi.org/project/whois/
我已经安装了所有whois软件包
import whois
domain = whois.whois('google.com')
print(domain)
即使我将第2行更改为 域= whois.query('google.com') 仍然我得到同样的错误。
我尝试使用easy -install.py进行操作,但是没有用。
但是,如果我仅在Cmd Prompt中运行whois google.com,我就会得到结果。但是即使安装了软件包,也不能使用python脚本。
答案 0 :(得分:0)
使用pip安装依赖项-“ pip install python-whois”
>>> import whois
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'whois'
>>>
(base) PS C:\Users\siva> **pip install python-whois**
Collecting python-whois
Downloading https://files.pythonhosted.org/packages/3e/32/3a7fa80b485f4a1c41492c062396441f2abf28865bb65d069c228af165f7/python-whois-0.7.1.tar.gz (83kB)
100% |████████████████████████████████| 92kB 33kB/s
Requirement already satisfied: future in c:\users\siva\appdata\local\continuum\anaconda3\lib\site-packages (from python-whois) (0.17.1)
Building wheels for collected packages: python-whois
Building wheel for python-whois (setup.py) ... done
Stored in directory: C:\Users\siva\AppData\Local\pip\Cache\wheels\09\69\68\dc484fdb90e36236630beafa07b21644b4280ce3ebd5f8b4b9
Successfully built python-whois
Installing collected packages: python-whois
Successfully installed python-whois-0.7.1
(base) PS C:\Users\siva> python
Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import whois
>>> w = whois.whois('google.com')
>>> w
{'domain_name': ['GOOGLE.COM', 'google.com'], 'registrar': 'MarkMonitor, Inc.', 'whois_server': 'whois.markmonitor.com', 'referral_url': None, 'updated_date': [datetime.datetime(2018, 2, 21, 18, 36, 40), datetime.datetime(2018, 2, 21, 10, 45, 7)], 'creation_date': [datetime.datetime(1997, 9, 15, 4, 0), datetime.datetime(1997, 9, 15, 0, 0)], 'expiration_date': [datetime.datetime(2020, 9, 14, 4, 0), datetime.datetime(2020, 9, 13, 21, 0)], 'name_servers': ['NS1.GOOGLE.COM', 'NS2.GOOGLE.COM', 'NS3.GOOGLE.COM', 'NS4.GOOGLE.COM', 'ns2.google.com', 'ns4.google.com', 'ns3.google.com', 'ns1.google.com'], 'status': ['clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited', 'clientTransferProhibited https://icann.org/epp#clientTransferProhibited', 'clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited', 'serverDeleteProhibited https://icann.org/epp#serverDeleteProhibited', 'serverTransferProhibited https://icann.org/epp#serverTransferProhibited', 'serverUpdateProhibited https://icann.org/epp#serverUpdateProhibited', 'clientUpdateProhibited (https://www.icann.org/epp#clientUpdateProhibited)', 'clientTransferProhibited (https://www.icann.org/epp#clientTransferProhibited)', 'clientDeleteProhibited (https://www.icann.org/epp#clientDeleteProhibited)', 'serverUpdateProhibited (https://www.icann.org/epp#serverUpdateProhibited)', 'serverTransferProhibited (https://www.icann.org/epp#serverTransferProhibited)', 'serverDeleteProhibited (https://www.icann.org/epp#serverDeleteProhibited)'], 'emails': ['abusecomplaints@markmonitor.com', 'whoisrequest@markmonitor.com'], 'dnssec': 'unsigned', 'name': None, 'org': 'Google LLC', 'address': None, 'city': None, 'state': 'CA', 'zipcode': None, 'country': 'US'}