python环境安装,使用技巧,隐藏小知识-尊龙凯时
-
path 配置d:\program files\python\python39
-
pip安装
- curl http://www.51sjk.com/upload/articles/1/0/266/266704_20210708013625098.py -o get-pip.py
- python get-pip.py
-
pip工具 path中配置d:\program files\python\python39\scripts
-
selenium安装,跳转到setup.py目录,运行 python setup.py install命令进行安装,安装完后用pip list可看到selenium的信息
-
requests安装
环境安装:
1、确保pip正常 cmd命令 pip 返回正常
2、安装requests: pip install requests
确认安装成功 pip list,若成功,则展示出requests3、卸载requests:pip uninstall requests
import requests r = requests.get('https://api.github.com/events') r.text u'[{"repository":{"open_issues":0,"url":"https://github.com/...
-
lxml安装 pip install lxml 支持xml,html文件
-
win32api安装 pip install pywin32
-
shell/idle 输入python进入,exit()退出
-
pyinstaller将py打包成exe
-
py脚本程序执行 python test.py执行文件
- wi r启动cmd,e:跳转盘符,cd跳转路径,dir查看文件,tab补全文件名,跳转到文件目录
- 管理员权限运行 搜cmd,以管理员权限运行cmd
- 在脚本文件夹按shift右键,打开powershell运行脚本
-
使用技巧
alt p:返回上一次的输入
alt n:与 alt p 相反
上面 p 的意思是 precious,n 的意思是 next
idle 里
ctrl [ :可以实现多行代码整体左移
ctrl ] :可以实现多行代码整体右移
. 操作符(点操作符)后使用 tab 可以查看有哪些东西,嫌提示出来的太慢可以在 options -> configure idle -> extension 里第一个那里配置
在未完成的变量后使用 tab 产生提示
alt 3 : 批量注释
alt 4 :批量取消注释
alt / :自动补全
options -> configure idle -> key 进入快捷键配置。