Python DNS module import error

后端 未结 13 1615
失恋的感觉
失恋的感觉 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:11

    I was getting an error while using "import dns.resolver". I tried dnspython, py3dns but they failed. dns won't install. after much hit and try I installed pubdns module and it solved my problem.

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

    I solved this by uninstalling and then re-installing the dnspython module with PIP.

    $ pip uninstall dnspython
    

    After the long list of files within pycache, type y to continue with the uninstall. After complete type:

    $ pip install dnspython
    

    I then ran my script and the errors were resolved.

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

    You could also install the package with pip by using this command:

    pip install git+https://github.com/rthalley/dnspython

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

    ok to resolve this First install dns for python by cmd using pip install dnspython
    (if you use conda first type activate and then you will go in base (in cmd) and then type above code) it will install it in anaconda site package ,copy the location of that site package folder from cmd, and open it . Now copy all dns folders and paste them in python site package folder. it will resolve it .

    actually the thing is our code is not able to find the specified package in python\site package bcz it is in anaconda\site package. so you have to COPY IT (not cut).

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

    I faced the same problem and solved this like i described below: As You have downloaded and installed dnspython successfully so

    1. Enter into folder dnspython
    2. You will find dns directory, now copy it
    3. Then paste it to inside site-packages directory

    That's all. Now your problem will go

    If dnspython isn't installed you can install it this way :

    1. go to your python installation folder site-packages directory
    2. open cmd here and enter the command : pip install dnspython

    Now, dnspython will be installed successfully.

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

    Very possible the version of pip you're using isn't installing to the version of python you're using. I have a box where this is the case...

    try:

    which python
    
    python --version
    
    pip -V
    

    If it looks like pip doesn't match your python, then you probably have something like the multiple versions of python and pip I found on my box...

    [root@sdpipeline student]# locate bin/pip
    
    /home/student/class/bin/pip
    
    /home/student/class/bin/pip-2.7
    
    /usr/bin/pip
    
    /usr/bin/pip-python
    

    As long as I use /home/student/class/bin/pip (2.7 that matches my python version on that box), then my imports work fine.

    You can also try installing pip from source: http://www.pip-installer.org/en/latest/installing.html

    There's probably a better way to do this, I'm still learning my way around too, but that's how I solved it -- hope it helps!

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