python
Tomatosky
这个作者很懒,什么都没留下…
展开
-
python boto3 的常用操作
安装pip install boto3配置windows在 C:\Users\%UserName%\ 文件夹下创建 .aws 文件夹创建名为 credentials 的文件,内容为:[default]aws_access_key_id = YOUR ACCESSKEYIDaws_secret_access_key = YOUR ACCESSKEY创建名为 config 的文件,内容为:[default]region = YOUR REGIONlinuxmkdir ~/.aw原创 2020-08-07 17:43:21 · 10519 阅读 · 1 评论 -
python将完整报错信息以字符串形式输出
try: print(a)except Exception as e: print(e)name 'a' is not defined有时候需要以字符串的形式输出报错内容,上面的方式虽然可以输出报错内容,但是报错信息不完整,特别是调用其它函数时,不容易定位出错位置,可以改成下面的方式import tracebacktry: print(a)except:...原创 2019-12-22 10:27:17 · 1191 阅读 · 0 评论 -
gunicorn Error: class uri 'gunicorn.workers.gthread.ThreadWorker' invalid or not found
今天在一台新的机子上运行guicorn的时候报了一个错Error: class uri 'gunicorn.workers.gthread.ThreadWorker' invalid or not found:[Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/gunicorn/...原创 2019-01-29 16:05:01 · 2870 阅读 · 0 评论 -
django笔记
文章目录创建项目创建项目创建应用视图url() 函数include()函数模板标签if标签for标签forloopifequal/ifnotequal 标签include标签block标签模型mysql数据库设置创建数据库表数据模型模型字段BooleanField:布尔值类型CharField:字符串类型DateField:日期类型DateTimeField:日期时间类型EmailField:邮箱...原创 2019-01-22 20:20:07 · 216 阅读 · 0 评论 -
ubuntu18.04安装pip3 Depends: python-pip-whl (= 8.1.1-2) but 8.1.1-2ubuntu0.4 is to be installed
下了个ubuntu18.04,更新源后安装pip3apt install python3-pip结果居然报错了Reading package lists... DoneBuilding dependency tree Reading state information... DoneSome packages could not be installed. This ma...原创 2018-11-28 13:50:16 · 11561 阅读 · 2 评论 -
xpath的使用
首先下载lxmlpip install lxml使用的时候导入模块from lxml import etree>>> def getxpath(html): #返回html的xml结构 return etree.HTML(html)>>> sample="""<html> ...转载 2018-07-04 08:52:49 · 263 阅读 · 0 评论 -
sublimetext3 配置python环境
手动安装Package Control:点击Preferences &amp;amp;amp;gt; Browse Packages菜单进入打开的目录的上层目录,然后再进入Installed Packages目录下载 https://sublime.wbond.net/Package%20Control.sublime-package 并复制到Installed Packages目录重启Sublime Tex...原创 2018-05-07 16:04:20 · 1282 阅读 · 0 评论 -
django创建项目报错:Note that only Django core commands are listed as settings are not
python 2.7 django 1.11按照教程创建项目django-admin.py startproject HelloWorld结果报错说 Note that only Django core commands are listed as settings are not properly configured (error: Requested se...原创 2018-05-05 12:57:29 · 17031 阅读 · 14 评论 -
ubuntu 搭建django开发环境(nginx+mysql+gunicorn)
服务器环境: ubuntu 16.04 python 2.7 本文公网地址用 123.123.123.123 代替1.安装phpstudy参考phpstudy官网给出的安装方法 http://lamp.phpstudy.net/我选择的是php5.5+nginx+mysql(其实没必要安装php,但是用这种一键安装包基本都是默认要求装php的) ...原创 2018-03-04 23:40:11 · 355 阅读 · 1 评论 -
ImportError: libmysqlclient.so.20: cannot open shared object file: No such file or directory
已经安装了mysql-python,但是在import MySQLdb的时候一直提示错误题目所示错误解决办法:卸载重装mysql-python就好了pip uninstall mysql-pythonpip install mysql-python...原创 2018-02-22 23:13:02 · 9895 阅读 · 0 评论 -
Flask web开发笔记(一)
1.创建Python的虚拟环境cd /home/ubuntu # 定位到需要放置虚拟环境的目录virtualenv venv # venv为虚拟环境目录名source venv/bin/activate # 激活虚拟环境当虚拟环境中的工作完成后,如果想回到全局Python 解释器中,可以在命令行提示符下输入deactivate。 2.程序原创 2018-02-06 22:50:02 · 321 阅读 · 0 评论 -
解决pip 8.1.1 无法升级到 pip 9.0.1
使用pip安装模块时提示You are using pip version 8.1.1, however version 9.0.1 is available.You should consider upgrading via the 'pip install --upgrade pip' command.哦,要升级啊,那就升级呗,输入:pip install --upgra原创 2018-01-09 14:22:39 · 4542 阅读 · 0 评论