python - 错误:命令出错,退出状态为 1:python setup.py egg_info 检查日志以获取完整的命令输出。尝试安装 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
我尝试了很多解决方案,但都没有奏效,请帮助我
解决方案
此软件包仅适用于 Python 2。它不再被维护(最近一次提交是在 2010 年),所以它被移植到 Python 3 的希望很小。
您可以改用pythonping包:
from pythonping import ping
ping('127.0.0.1', verbose=True)
推荐阅读
- html - 我已尽我所能,但我的网站无法在 iPhone 上运行或响应
- sql - 通过 ODBC 而不是 ADODB 访问 Excel VBA 数据库
- java - 使用 codelabs 构建我的第一个应用程序遇到了一些问题
- view - 如何在swiftui中访问其他视图结构中的视图结构
- python - 分析数据时如何避免重复表达?
- android - 将自定义类保存到 Firestore 时如何正确排除 Document Id 属性?
- python - 如何在 python dash 应用程序中绘制来自传感器的串行信号?
- python - 使用带有关键字列表的 Scrapy
- reactjs - 如何将键分配给地图功能Javascript
- macos - 基于文档的应用程序,其中顶级文档代表窗口,而不是选项卡