02.python介绍和pycharm安装

02.python介绍和pycharm安装

一、 python语言概述

1 介绍

1.1 概述

python语言特点:简单&功能强大
官方介绍:
Python是一款易于学习且功能强大的编程语言。它具有高效率的数据结构,能够简单又有效地实现面向对象编程。 Python简洁的语法与动态输入之特性,加之其解释性语言的本质,使得它成为一种在多种领域与绝大多数平台都能进行脚本编写与应用快速开发工作的理想语言
Python的创造者吉多·范罗苏姆
吉多 龟叔 大神 1989
1991年出现python第一个版本,python解释器
java 1990年出现 1995年流行 sun公司支持

1.2 python特色:

简单
易于学习
自由且开放 开源:(python,java都是开源的)
跨平台
可嵌入性
丰富的库

Life is short I use Python
人生苦短,我用python

python可以提升工作效率

1.3 Python的发展及应用

发展:
PC端的互联网 --> 移动互联网(3G 4G Android iOS) --> 大数据互联网 --> AI
~2010 --> 2010 ~ 2015年 --> 2016年 ~ 现在 -->

python应用:

  • 常规软件开发
  • 科学计算
  • 自动化运维
  • 自动化测试
  • WEB开发
  • 网络爬虫
  • 数据分析
  • 人工智能

人脸识别 是 计算机来识别,要实现这个功能
需要大量的数据来进行训练。

python之禅: import this

The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

2. 搭建环境

  1. python的解释器
    环境搭建就是安装python的解释器
    分类:
    CPython 官方版本 C语言编写的python解释器
    PyPy 用Python编写的python解释器
    JPython 用java编写的python解释器

  2. 搭建python环境
    官方网站: https://python.org

3. 编写

a.py

print("hello world")

a.java

class Demo
{
	public static void main(String[] args) {
		System.out.println('hello world');
	}
}

二、python安装

1. pip工具的使用

查看pip版本:

pip -V
pip --version

显示包的信息

pip show pygame

普通安装

pip install requests

安装指定版本

pip install requests==2.23   # 指定版本
pip install requests>=2.23   # 最小版本

卸载已安装的库

pip uninstall requests

列出已安装的库

pip list

如果升级pip版本失败,则需要重新安装pip

# 升级命令:
python -m pip install --upgrade pip

将已安装的库列表保存到文本文件中

pip freeze > D:\install.txt

使用wheel文件安装
网址:https://www.lfd.uci.edu/~gohlke/pythonlibs

1. 安装wheel
pip install wheel

2. 下载wheel文件,***.whl

3. 执行命令安装
pip install ***.whl

2. pycharm安装

建议用社区版

不使用汉化版原因:

  1. 汉化版有bug
  2. 公司企业都用原版

修改主题:
Ctrl + Alt + S 打开设置
Appearance & Behavior --> Appearance
修改右边Theme,选择主题。

修改字体大小:
Editor --> Font
修改右边Size的值。

关闭更新:
Appearance & Behavior --> System Settings --> Updates
去掉 Automatically check updates for 的勾

快捷键修改:
Keymap
修改习惯的方式

自动导包:
Editor --> General --> Auto Import
右边Python 勾选Show import popup

启动时,不打开上次的项目
Appearance --> System Settings
右边 Startup/Shurdown下方
取消 Reopen last project on startup 的勾

设置文件头部信息
Editor --> Code Style --> File and Code Templates
右边选择Files – Python Script,输入相关信息

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author   : wangtiandi
# @Time     : ${DATE} ${TIME}
# @File     : ${NAME}.py
# @Software : ${PRODUCT_NAME}

安装一些模块时,有依赖关系。已经安装的模块多,以后安装时可能就方便。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值