环境:ubuntu,python2/3
命令:
pip3 install ipy # 通过pip3给python3.x安装ipy
pip3 install --upgrade pip # 升级pip
pip install ipy # 通过pip给python2.x安装ipy
如果显示程序“pip/pip3”尚未安装
sudo apt-get install python3-pip # 安装python3的pip
sudo apt-get install python-pip # 安装python2的pip
验证:
python3 from IPy import IP ip = IP("192.168.0.0/24") print(ip.len()) # 输出IP段有多少个IP可用 # 输出:256