错误:命令错误,退出状态为1:python setup.py egg_info检查日志以获取完整的命令输出。尝试安装ping模块时

时间:2020-06-30 13:45:41

标签: python module ping

sh: ping: command not found

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Collecting ping
  Using cached ping-0.2.tar.gz (10 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/q3/1cj5lfqn0ds0plbtnv9tqr4r0000gn/T/pip-install-4fgeslm7/ping/setup.py'"'"'; __file__='"'"'/private/var/folders/q3/1cj5lfqn0ds0plbtnv9tqr4r0000gn/T/pip-install-4fgeslm7/ping/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/q3/1cj5lfqn0ds0plbtnv9tqr4r0000gn/T/pip-pip-egg-info-p_o79ek6
         cwd: /private/var/folders/q3/1cj5lfqn0ds0plbtnv9tqr4r0000gn/T/pip-install-4fgeslm7/ping/
    Complete output (8 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/q3/1cj5lfqn0ds0plbtnv9tqr4r0000gn/T/pip-install-4fgeslm7/ping/setup.py", line 23, in <module>
        from ping import __version__
      File "/private/var/folders/q3/1cj5lfqn0ds0plbtnv9tqr4r0000gn/T/pip-install-4fgeslm7/ping/ping.py", line 196
        except socket.error, (errno, msg):
                           ^
    SyntaxError: invalid syntax

我尝试了许多解决方案,但都无济于事,p [请协助我

1 个答案:

答案 0 :(得分:0)

此软件包仅适用于Python 2。它不再维护(the latest commit是2010年),因此几乎没有希望将其移植到Python 3。

您可以改用pythonping软件包:

from pythonping import ping

ping('127.0.0.1', verbose=True)