简体   繁体   English

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

[英]Module whois not working in Python 3 even after importing it

Please Check the following output i get after installing and import whois module can someone help with this issue ?请检查我在安装和导入 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 "<stdin>", line 1, in <module>
  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'
`

首先检查你是否可以通过这个命令whois google.com手动查找 whois,如果有任何错误,你必须先使用sudo apt-get install whois

I also faced the same issue.我也面临同样的问题。 I installed the whois library using pip and it was not working.我使用 pip 安装了whois库,但它无法正常工作。 Then I used然后我用

sudo apt-get install whois

to re-install the whole module and then it worked fine.重新安装整个模块,然后它工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM