首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >错误ModuleNotFoundError:没有名为“whois.whois”的模块

错误ModuleNotFoundError:没有名为“whois.whois”的模块
EN

Stack Overflow用户
提问于 2019-08-28 09:31:08
回答 1查看 2.6K关注 0票数 0

我听到这个错误说

代码语言:javascript
运行
复制
 ModuleNotFoundError: No module named 'whois.whois' from https://pypi.org/project/python-whois/

https://pypi.org/project/whois/

我已经安装了所有的软件包

代码语言:javascript
运行
复制
import whois
domain = whois.whois('google.com')
print(domain)

即使我将第2行更改为whois.query=google.com(‘google.com’),也会得到相同的错误。

我试过使用简单的-install.py,但没有起作用。

但是,如果我在Cmd提示符中只运行whois google.com,我就会得到结果。但是在python脚本中没有,即使包已经安装了。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-08-28 10:18:22

使用pip - "pip Install python-whois“安装依赖项。

代码语言:javascript
运行
复制
>>> 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'}
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57689200

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档