https://www.python.org/ftp/python/3.6.4/python-3.6.4-amd64.exe
很简单,下一步下一步就行,装完后配置环境变量。若安装时选择了也安装pip(推荐,否则pip和python版本不对应可能会报错),则可直接用pip安装IPy
测试安装结果
C:\Users >python -V
Python 3.6.4
https://blog.csdn.net/weixin_37998647/article/details/79265364
1. 安装pip
https://blog.csdn.net/catstarxcode/article/details/79724764
下载安装包
或者联网安装(会下载最新版本,注意当前python版本是否支持)
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
E:\python36>curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1733k 100 1733k 0 0 11025 0 0:02:41 0:02:41 --:--:-- 47359
E:\python3.7.4>python get-pip.py
Collecting pip
Downloading https://files.pythonhosted.org/packages/62/ca/94d32a6516ed197a491d17d46595ce58a83cbb2fca280414e57cd86b84dc/pip-19.2.1-py2.py3-none-any.whl (1.4MB)
|████████████████████████████████| 1.4MB 22kB/s
Collecting setuptools
Using cached https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl
Collecting wheel
Using cached https://files.pythonhosted.org/packages/bb/10/44230dd6bf3563b8f227dbf344c908d412ad2ff48066476672f3a72e174e/wheel-0.33.4-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
WARNING: The script wheel.exe is installed in 'E:\python36\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-19.2.1 setuptools-41.0.1 wheel-0.33.4
https://blog.csdn.net/catstarxcode/article/details/79724764
2. 设置环境变量
将pip命令路径E:\Python36\Scripts加入环境变量
3. cmd
pip install IPy
C:\Users>pip install IPy
Collecting IPy
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/e1/66/b6dd22472bb027556849876beae2dd4dca3a4eaf2dd3039277b4edb8c6af/IPy-1.00.tar.gz
Installing collected packages: IPy
Running setup.py install for IPy ... done
Successfully installed IPy-1.0
You are using pip version 9.0.1, however version 19.2.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
4. 测试IPy
C:\Users>python -V
Python 3.6.4
安装过程基本也是点下一步
1. Activation
pycharm过期之后每次只能打开30分钟,然后会强制关闭。
pycharm的Activation code网上找的通常都是一年或者半年有效期,需要经常更新,有些甚至早都过期了。License server方式相当于把大量可用的license聚集起来,然后在多个用户间共享,每个用户每次分配到的license可能都不一致,但是基本不需要担心过期的问题。
2. 新建项目
选择项目路径,由于已经安装了python,我们直接指定路径就可以。
选择新环境它会自己安装python和pip,时间比较长,而且python和pip版本不对应,用pip安装包时总会遇到版本不对的报错
新建文件前先设置下文件模板
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#@Time : ${DATE} ${TIME}
#@Author: Hehuyi_In
#@File : ${NAME}.py
新建python文件时就会默认带上
运行结果
更换包为国内源
https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/
搜索IPy,点击安装即可
测试IPy
from IPy import IP
print(IP("192.168.1.112").version()) # 查看ip版本(IPV4或IPV6)
print(IP("::1").version()) # IPV6
ip=IP("198.168.0.0/16") # 网络子网所有ip
print(ip.len())
print(ip.iptype()) # ip类型(内网或外网ip)
print(ip.reverseNames()) # 反解析名
print(ip.int(),ip.strBin(),ip.strHex()) #不同进制显示ip
参考
https://www.runoob.com/w3cnote/pycharm-import-python-package.html
https://blog.csdn.net/qq_36373262/article/details/78977667