Python小技巧

pip安装超时
异常信息:pip._vendor.urllib3.exceptions.ReadTimeoutError: 
HTTPSConnectionPool(host
='files.pythonhosted.org', port=443): Read timed out 解决方案:在执行安装命令的时候,可以指定超时时间 具体命令:pip --default-timeout=100 install 包名

 

Python解析json异常
异常信息:AttributeError: 'bytes' object has no attribute 'read'
解决方案:在用内只json函数解析json脚本的时候,需要使用json.loads(jsonText),如果使用json.load(jsonText)就会报上面这个错误

 

Python设置linux环境的全局信息
#
设置git用户名、密码、邮箱的配置(全局配置) $ git config --global user.name 用户命 $ git config --global user.password 密码 $ git config --global user.password "test@test.com"

 

posted @ 2020-06-22 18:28  YN程序猿  阅读(117)  评论(0编辑  收藏  举报