安装pydns时出错

时间:2016-12-27 09:34:16

标签: python python-3.x pip

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

pip install py3dns

我也试过List,但它不起作用。

3 个答案:

答案 0 :(得分:2)

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

对于python3,请使用pip3 install py3DNS

答案 1 :(得分:0)

Python 3不支持pydns。您需要使用python 2.7来处理它。

答案 2 :(得分:0)

pyDNS和dnspython内置软件包之间似乎存在冲突:

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

步骤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

享受