【问题标题】:Error installing pydns安装 pydns 时出错
【发布时间】:2017-05-11 14:03:38
【问题描述】:

在尝试安装 pydns 模块时,我收到此错误:

C:\Windows\system32>pip install pydns
Collecting pydns
  Using cached pydns-2.3.6.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
  File "C:\Users\Shiva\AppData\Local\Temp\pip-build-294324_x\pydns\setup.py", line 12, in <module>
    import DNS
  File "C:\Users\Shiva\AppData\Local\Temp\pip-build-294324_x\pydns\DNS\__init__.py", line 14, in <module>
    import Type,Opcode,Status,Class
ImportError: No module named 'Type'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Shiva\AppData\Local\Temp\pip-build-294324_x\pydns\

我也试过pip install py3dns,但它不起作用。

【问题讨论】:

  • 请帮我摆脱这个错误。

标签: python python-3.x pip


【解决方案1】:

您使用了错误版本的 python。 python 3不支持pydns。pydns适用于python2.7

对于 python3 使用pip3 install py3DNS

【讨论】:

    【解决方案2】:

    Python 3 不支持 pydns。您需要使用 python 2.7 才能使用它。

    【讨论】:

      【解决方案3】:

      好像pyDNS和dnspython内置包有冲突:

      ** / ! \ 要为 python3 运行此解决方案,请将 pyDNS 替换为 py3DNS**

      第 1 步删除 dnspython:

      $ pip uninstall dnspython
      
      DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
      Found existing installation: dnspython 1.15.0
      Uninstalling dnspython-1.15.0:
        Would remove:
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/*
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dnspython-1.15.0.dist-info/*
        Would not remove (might be manually added):
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Base.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Base.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Class.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Class.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Lib.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Lib.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Opcode.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Opcode.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Status.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Status.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Type.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Type.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/lazy.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/lazy.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/win32dns.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/win32dns.pyo
      Proceed (y/n)? y
        Successfully uninstalled dnspython-1.15.0
      

      第 2 步删除 pyDNS:

      $ pip uninstall pydns
      
      DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
      Found existing installation: pydns 2.3.6
      Uninstalling pydns-2.3.6:
        Would remove:
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Base.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Base.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Class.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Class.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Lib.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Lib.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Status.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Status.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Type.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Type.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/lazy.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/lazy.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/win32dns.py
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/win32dns.pyo
          /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydns-2.3.6.dist-info/*
      Proceed (y/n)? y
        Successfully uninstalled pydns-2.3.6`
      
      ### Step 2 Install pyDNS again  :
      `$ pip install pydns
      
      DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
      Processing /Library/Caches/pip/wheels/54/c3/70/622b2f4958520225fab47eceb1e2659ac4d03ec6760ec26024/pydns-2.3.6-py2-none-any.whl
      Installing collected packages: pydns
      Successfully installed pydns-2.3.6
      

      第 3 步检查已安装的软件包:

      $ python -m DNS
      
      /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named DNS.__main__; 'DNS' is a package and cannot be directly executed
      

      享受

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-09-12
        • 2013-10-05
        • 2013-08-15
        • 2013-11-13
        相关资源
        最近更新 更多