开发者社区> 问答> 正文

即使在导入之后,模块也无法在Python 3中工作

检查安装和导入后得到的以下输出whois模块有人可以帮助解决这个问题吗?
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import whois
domain = whois.query('www.google.com')
Traceback (most recent call last):

File "", line 1, in
File "/usr/local/lib/python3.6/dist-packages/whois/__init__.py", line 50, in query

pd = do_parse(do_query(d, force, cache_file, slow_down, ignore_returncode), tld)

File "/usr/local/lib/python3.6/dist-packages/whois/_1_query.py", line 44, in do_query

_do_whois_query(dl, ignore_returncode),

File "/usr/local/lib/python3.6/dist-packages/whois/_1_query.py", line 58, in _do_whois_query

p = subprocess.Popen(['whois', '.'.join(dl)], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

File "/usr/lib/python3.6/subprocess.py", line 709, in init

restore_signals, start_new_session)

File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child

raise child_exception_type(errno_num, err_msg, err_filename)

FileNotFoundError: [Errno 2] No such file or directory: 'whois': 'whois'

展开
收起
一码平川MACHEL 2019-01-18 11:14:12 2971 0
3 条回答
写回答
取消 提交回答
  • pip install python-whois

    image.png

    2019-11-22 14:17:50
    赞同 展开评论 打赏
  • 最后提示是
    FileNotFoundError: [Errno 2] No such file or directory: 'whois': 'whois'

    意思是没有找到whois这个命令,需要手动执行下安装

    2019-07-17 23:25:52
    赞同 展开评论 打赏
  • 首先检查是否可以通过此命令手动查找whois whois google.com,如果有任何错误,则必须先安装whoissudo apt-get install whois

    2019-07-17 23:25:52
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载