Python DNS module import error

后端 未结 13 1617
失恋的感觉
失恋的感觉 2020-12-03 16:39

I have been using python dns module.I was trying to use it on a new Linux installation but the module is not getting loaded. I have tried to clean up and install but the ins

相关标签:
13条回答
  • 2020-12-03 17:34

    I installed dnspython 1.11.1 on my Ubuntu box using pip install dnspython. I was able to import the dns module without any problems

    I am using Python 2.7.4 on an Ubuntu based server.

    0 讨论(0)
  • 2020-12-03 17:34

    I installed DNSpython 2.0.0 from the github source, but running 'pip list' showed the old version of dnspython 1.2.0

    It only worked after I ran 'pip uninstall dnspython' which removed the old version leaving just 2.0.0 and then 'import dns' ran smoothly

    0 讨论(0)
  • 2020-12-03 17:36

    One possible reason here might be your script have wrong shebang (so it is not using python from your virtualenv). I just did this change and it works:

    -#!/bin/python
    +#!/usr/bin/env python
    

    Or ignore shebang and just run the script with python in your venv:

    $ python your_script.py
    
    0 讨论(0)
  • 2020-12-03 17:37

    I ran into the same issue with dnspython.

    My solution was to build the source from their official GitHub project.

    So my steps were:

    git clone https://github.com/rthalley/dnspython
    cd dnspython/
    python setup.py install
    

    After doing this, I was able to import the dns module.

    EDIT

    It seems the pip install doesn't work for this module. Install from source as described.

    0 讨论(0)
  • 2020-12-03 17:37

    On Debian 7 Wheezy, I had to do:

    pip install --upgrade dnspython
    

    even if python-dns package was installed.

    0 讨论(0)
  • 2020-12-03 17:37

    This issue can be generated by Symantec End Point Protection (SEP). And I suspect most EPP products could potentially impact your running of scripts.

    If SEP is disabled, the script will run instantly.

    Therefore you may need to update the SEP policy to not block python scripts accessing stuff.

    0 讨论(0)
提交回复
热议问题