02-Python要点

02-Python要点

  • 1、Python语言
    • 1.1、Python语言的基本概念

    • 1.2、Python的特点

      • 简单
      • 易于学习
      • 自由且开放
      • 跨平台
      • 可嵌入性(在别的语言中嵌入Python)
      • 丰富的库
    • 1.3、Python的发展

    • 1.4、Python的应用

      • 常规软件开发
      • 科学计算
      • 自动化运维
      • 自动化测试
      • WEB开发
      • 网络爬虫
      • 数据分析
      • 人工智能
    • 1.4、Python给咱的寄语

      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、搭建环境
    • 2.1、Python的解释器
      • 环境搭建就是安装Python的解释器
      • Python的解释器分类:
      • CPython(官方我们用的就是这个版本) 用c语言编写的Python解释器
      • PyPy 用Python语言编写的Python解释器
      • JPython 用Java编写的Python解释器
    • 2.2、搭建Python环境
      • 下载安装包(官网

      • 安装完成

      • 2.3、pip工具的使用

        • pip介绍
          pip 是一个现代的,通用的 Python 包管理工具。提供了对 Python 包的查找、下载、安装、卸载的功能。

        python有两个著名的包管理工具easy_install和pip。在python 2中easy_install是默认安装的,而pip需要我们手动安装。随着Python版本的提高,easy_install已经逐渐被淘汰,但是一些比较老的第三方库,在现在仍然只能通过easy_install进行安装。目前,pip已经成为主流的安装工具,自Python 2 >=2.7.9或者Python 3.4以后默认都安装有pip

        • pip使用
          • 在命令行下,输入pip,回车可以看到帮助说明:
        • 查看pip版本
        pip -V
        pip --version
        
        • 普通安装
        pip install requests
        
        • 指定版本安装
        pip install robotframework==2.8.7
        
        • 卸载已经安装的库
        pip uninstall requests
        
        pip install SomePackage             
        pip install SomePackage==1.0.5       # 指定版本
        pip install 'SomePackage>=1.0.6'     # 最小版本
        

        升级指定的包,通过使用==, >=, <=, >, < 来指定一个版本号。

        • 列出已经安装的库
        pip list
        

        在这里插入图片描述

        • 显示所安装包的信息
        pip show package
        
        • 使用wheel文件安装
        • 换源安装
          1.豆瓣 :http://pypi.douban.com/simple/
          2.阿里 :http://mirrors.aliyun.com/pypi/simple/
          3.中国科学技术大学:http://pypi.mirrors.ustc.edu.cn/simple
          4.清华:https://pypi.tuna.tsinghua.edu.cn/simple
          例如:pip install SomePackage -i https://pypi.douban.com/simple
      • 2.5、Python的第一个程序

        • 可以在交互模式实现
          在这里插入图片描述
        • 可以用Python自带的idle
          在这里插入图片描述
        • 可以用高级开发工具如 : PyCharm
          在这里插入图片描述
  • 3、PyCharm的安装
    官网在这里插入图片描述
    • 安装完成后打开,一般会新建项目:
      在这里插入图片描述
      • New environment using就是使用虚拟环境。
      • Exiting interpreter就是使用已经存在的环境,全局的。
      • 创建之后就可以尝试写自己的第一个程序了。
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值