pip

开工第一天,先用Python戴个口罩

本秂侑毒 提交于 2020-11-28 03:08:36
Python实用宝典终于复工啦 (我咸鱼够了) !这些天,令人揪心的肺炎疫情一直闹得沸沸扬扬,口罩也被抢得断货,许多网友朋友们都只能开始给自己的头像戴口罩了 (也挺好,为疫区省点医疗物资) 。 有个朋友(Prodesire)一早就预料到有这种情况,因此ta开发了一个工具,能让大家用一行语句就成功戴上口罩! 1.准备 老规矩,在开工前一定要安装好Python,如果还没安装请看这篇文章:超详细Python安装教程。安装完Python后我们就可以安装Prodesire开发的一个叫做face-mask的模块。 如果你是windows机器,请在 开始—运行 中输入cmd,执行 pip install face-mask 如果你是macOS机器,请command+空格,输入Terminal打开终端,执行 pip install face-mask 如果出现:CMake must be installed to build the following extensions: dlib 这样的错误,请先安装cmake: pip install cmake 2.使用 同样地,打开cmd或终端,输入以下命令,就能在该图片的当前文件夹下生成一张戴着口罩的图片: face-mask 图片路径 比如说宽叔的这张图片: 输入命令 face-mask Downloads/2.jpg 即可生成戴口罩的图片:

pycharm连接mysql数据库

和自甴很熟 提交于 2020-11-27 07:34:09
1.设置pycharm   pycharm默认字体很小12,修改成18,在setting中搜索font,设置字体大小。   设置pycharm的快捷键为visual studio      配置django环境settings.py    LANGUAGE_CODE = ' zh-hans ' TIME_ZONE = ' Asia/Shanghai ' USE_I18N = True USE_L10N = True USE_TZ = False zh-hans是django2只用的中文语音包,时区使用 'Asia/Shanghai',世界时间 USE_TZ 使用否False 2. 创建mysql数据库 3. 设置mysql配置      使用vs的快捷键 ctrl + alt + f 格式化代码,这样就不用手动去调整空格或者空两行之类的了       DATABASES = { ' default ' : { ' ENGINE ' : ' django.db.backends.mysql ' , ' NAME ' : ' mxonline ' , ' USER ' : ' root ' , ' PASSWORD ' : ' root ' , } } name是数据库,user是用户名,host和por都可以留空,为默认。左边的键名必须为全大写。之前我有次把USER写成了User

Flask之项目配置,目录构建,闪现

寵の児 提交于 2020-11-27 02:44:09
综合案例:学生成绩管理 新建项目目录students,并创建虚拟环境 mkvirtualenv students 安装开发中使用的依赖模块 pip install flask == 0.12.4 pip install redis pip install flask-session pip install flask-script pip install flask-mysqldb pip install flask-sqlalchemy pip install flask-migrate pip install flask_wtf 在pycharm中打开项目目录编写manage.py启动项目的文件 创建 manage.py 文件 from flask import Flask ​ app = Flask( __name__) ​ @app. route( '/index') def index(): return 'index' ​ if __name__ == '__main__': app. run() mange.py终不能存放大量的开发代码, 在开发中应该体现的是一种分工精神,所以我们可以把flask中各种功能代码进行分类分文件存储. 创建项目目录结构: 项目根目录/ ├── application/ # 项目主要逻辑代码保存目录 | ├── settings/ #

python爬虫基础15-python图像处理,PIL库

风格不统一 提交于 2020-11-26 07:27:38
Python图像处理-Pillow 简介 Python传统的图像处理库 PIL (Python Imaging Library ),可以说基本上是Python处理图像的标准库,功能强大,使用简单。 但是由于 PIL 不支持Python3,而且更新缓慢。所以有志愿者在 PIL 的基础上创建了一个分支版本,命名为 Pillow , Pillow 目前最新支持到python3.6,更新活跃,并且增添了许多新的特性。所以我们安装Pillow即可。 安装 Pillow 的安装比较的简单,直接pip安装即可: pip install Pillow 但是要注意的一点是, Pillow 和 PIL 不能共存在同一个环境中,所以如果安装的有 PIL 的话,那么安装 Pillow 之前应该删除 PIL 。 由于是继承自 PIL 的分支,所以 Pillow 的导入是这样的: import PIL # 或者 from PIL import Image 使用手册 Image Image 是Pillow中最为重要的类,实现了Pillow中大部分的功能。要创建这个类的实例主要有三个方式: 从文件加载图像 处理其他图像获得 创建一个新的图像 读取图像 一般来说,我们都是都过从文件加载图像来实例化这个类,如下所示: from PIL import Image picture = Image. open(

Checking whether the pip is installed?

雨燕双飞 提交于 2020-11-26 07:17:55
问题 I am using Python 2.7.12 and I want to check whether the pip is installed or not. For this, in command line of Python application I wrote pip list and pressed enter. However, I get an error like: File"stdin",line 1 pip list Syntax Error: invalid syntax So, how can I solve this issue and get the list of modules as an output? Thanks 回答1: Use command line and not python. TLDR; On Windows, do: python -m pip --version Details: On Windows, ~> (open windows terminal) Start (or Windows Key) > type

Checking whether the pip is installed?

独自空忆成欢 提交于 2020-11-26 07:17:30
问题 I am using Python 2.7.12 and I want to check whether the pip is installed or not. For this, in command line of Python application I wrote pip list and pressed enter. However, I get an error like: File"stdin",line 1 pip list Syntax Error: invalid syntax So, how can I solve this issue and get the list of modules as an output? Thanks 回答1: Use command line and not python. TLDR; On Windows, do: python -m pip --version Details: On Windows, ~> (open windows terminal) Start (or Windows Key) > type

Checking whether the pip is installed?

与世无争的帅哥 提交于 2020-11-26 07:17:28
问题 I am using Python 2.7.12 and I want to check whether the pip is installed or not. For this, in command line of Python application I wrote pip list and pressed enter. However, I get an error like: File"stdin",line 1 pip list Syntax Error: invalid syntax So, how can I solve this issue and get the list of modules as an output? Thanks 回答1: Use command line and not python. TLDR; On Windows, do: python -m pip --version Details: On Windows, ~> (open windows terminal) Start (or Windows Key) > type

python之web自动化验证码识别解决方案

主宰稳场 提交于 2020-11-26 04:26:29
验证码识别解决方案 对于web应用程序来讲,处于安全性考虑,在登录的时候,都会设置验证码,验证码的类型种类繁多,有图片中辨别数字字母的,有点击图片中指定的文字的,也有算术计算结果的,再复杂一点就是滑动验证的。诸如此类的验证码,对我们的系统增加了安全性的保障,但是对于我们测试人员来讲,在自动化测试的过程中,无疑是一个棘手的问题。 1、web自动化验证码解决方案 一般在我们测试过程中,登录遇到上述的验证码的时候,有以下种解决方案: 第一种、让开发去掉验证码 第二种、设置一个万能的验证码 第三种、通过cookie绕过登录 第四种、自动识别技术识别验证码 2、自动识别技术识别验证码 前三种解决方案,想必大家都比较了解,本文重点阐述第四种解决方案,也就是验证码的自动识别,关于验证码识别这一块,可以通过两个方案来解决, 第一种是:OCR自动识别技术, 第二种是:通过第三方打码平台的接口来识别。 OCR识别技术 OCR中文名称光学识别, tesseract是一个有名的开源OCR识别框架,它与Leptonica图片处理库结合,可以读取各种格式的图像并将它们转化成超过60种语言的文本,可以不断训练自己的识别库,使图像转换文本的能力不断增强。如果团队深度需要,还可以以它为模板,开发出符合自身需求的OCR引擎。那么接下来给大家介绍一下如何使用tessract来识别我们的验证码。 关于OCR自动识别这一块

把vim打造成适配python和golang的庆亮级编辑器

喜欢而已 提交于 2020-11-25 11:55:06
#!/bin/bash if [ whoami != root ] then echo "Please login as root to continue :)" exit 1 fi if [ ! -d /home/tools/ ];then mkdir -p /home/tools else rm -rf /home/tools && mkdir -p /home/tools fi #Install python3 yum -y install epel-release wget && sudo yum -y groupinstall 'Development Tools' && sudo yum -y install the_silver_searcher sudo yum -y update sudo yum -y install yum-utils sudo rpm -Uvh https://repo.ius.io/ius-release-el7.rpm sudo yum install python36u -y sudo yum -y install python36u-pip python36u-devel #config env mkdir -p /data cd /data python3.6 -m venv venv #Install golang wget -c