我尝试使用pip
安装python-ping但我得到了:
Downloading/unpacking python-ping
Could not find a version that satisfies the requirement python-ping (from versions: 2011.10.12.11fc9f7, 2011.10.12.1d8e600, 2011.10.13.12050a5, 2011.10.17.376a019)
Cleaning up...
No distributions matching the version for python-ping
Storing debug log for failure in /root/.pip/pip.log
所以我用pip install --pre python-ping
安装了它并输出了安装:
Downloading/unpacking python-ping
Downloading python-ping-2011.10.17.376a019.tar.gz
Running setup.py (path:/tmp/pip-build-8QnXqD/python-ping/setup.py) egg_info for package python-ping
warning: no previously-included files matching '*.pyc' found under directory '*'
warning: no previously-included files matching '*.pyo' found under directory '*'
Installing collected packages: python-ping
Running setup.py install for python-ping
changing mode of build/scripts-2.7/ping.py from 644 to 755
warning: no previously-included files matching '*.pyc' found under directory '*'
warning: no previously-included files matching '*.pyo' found under directory '*'
changing mode of /usr/bin/ping.py to 755
Successfully installed python-ping
Cleaning up...
尽管有警告我认为它是成功的。
然后我尝试导入ping模块给它一个测试,复制粘贴first answer here,但我得到了:
ImportError: No module named ping
首次使用pip
安装模块时遇到任何问题。我该如何解决这个问题?
答案 0 :(得分:1)
根据setup.py
包的python-ping
,它不会安装模块,而是安装一个脚本(应该安装在python脚本文件夹中)。您应该直接调用脚本,例如:ping.py www.google.com
。如果这不起作用,请确保您的路径设置为包含系统上的python脚本文件夹。
如果您更喜欢模块解决方案,请查看pypi上的ping
,https://pypi.python.org/pypi/ping/0.2