51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1616|回复: 4
打印 上一主题 下一主题

关于python的困惑

[复制链接]
  • TA的每日心情
    无聊
    前天 10:23
  • 签到天数: 58 天

    连续签到: 1 天

    [LV.5]测试团长

    跳转到指定楼层
    1#
    发表于 2018-2-7 14:49:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
            最近完全被python的各种版本,安装包,工具什么的弄疯了,感觉与python相关的东西太多了,
    一时间让人分辨不出来到底什么是干什么的。于是,我疯狂的查阅各种资料,才逐渐慢慢理解了与
    python相关的各种工具和包。下面,将我的困惑记录下来,希望可以和有同样烦恼的朋友分享!

           1. conda、pip和anaconda到底是干嘛的,有什么区别?

           在各种网站上找了好久,最后发现其实这些问题都可以从官方网站上找到。关于conda和
    anaconda可以从anaconda官网找到,关于pip可以从python官网找到。下面我简单摘录一些网站上
    的说明供大家参考。

           anaconda、miniconda和conda

           什么是anaconda
           anaconda是一种开源的,易安装的高性能python和R发行版,它集成了conda包和环境管理工具,
    并且有1000+免费社区支持的开源包。

           It is an open source, easy-to-install high performance Python and R distribution, with the conda
    package and environment manager and collection of 1,000+ open source packages with free community
    support.

           为什么要用anaconda
           安装python作为终端一点也不好玩。许多科学包要求python的特定版本才能运行,并且它很难使各
    种包交互。很难保持更新。anaconda发行版可以快速简单的获取和更新这些包

            Installing Python in a terminal is no joy. Many scientific packages require a specific version of Python
    to run, and it’s difficult to keep them from interacting with each other. It is even harder to keep them
    updated. Anaconda Distribution makes getting and maintaining these packages quick and easy.

           什么是miniconda?
           miniconda是没有1000+开源包的发行版,使用miniconda你只能使用conda命令安装你想用的包。

           It’s Anaconda Distribution without the collection of 1,000+ open source packages.
    With Miniconda you install only the packages you want with the conda command,

           什么是anaconda navigator?
    anaconda navigator 可以非常容易的使用图形化python编程而不需要使用命令行。

           Anaconda Navigator is an easy way to use graphical Python programs without having to use
    command line commands.

            从这里我们可以知道,anaconda是一个平台,而conda是包和环境管理工具。
    在python官方文档中的安装工具建议中可以看到,pip是一个安装python包的工具。 那么pip与conda有
    什么区别呢?

           conda是Anaconda Python安装的软件包管理工具。 Anaconda Python是Continuum Analytics的一
    个发行版,专门针对科学界,尤其是在二进制扩展安装通常很困难的Windows上。

           Conda是一个完全独立的工具,用于管理,虚拟化和轮式,但在包管理,虚拟环境管理和二进
    制扩展的部署方面提供了许多它们的组合功能。

           Conda不从PyPI安装软件包,只能从官方的Continuum存储库或anaconda.org(用户提供的
    conda软件包的地方)或本地(例如内联网)软件包服务器进行安装。 但是请注意,可以将pip安装
    到并且与conda一起工作来管理来自PyPI的分发。

          conda is the package management tool for Anaconda Python installations. Anaconda Python is a
    distribution from Continuum Analytics specifically aimed at the scientific community, and in particular
    on Windows where the installation of binary extensions is often difficult.

         Conda is a completely separate tool to pip, virtualenv and wheel, but provides many of their combined
    features in terms of package management, virtual environment management and deployment of binary
    extensions.

         Conda does not install packages from PyPI and can install only from the official Continuum
    repositories, or anaconda.org (a place for user-contributed conda packages), or a local (e.g. intranet)
    package server. However, note that pip can be installed into, and work side-by-side with conda for
    managing distributions from PyPI.

         另外,下面是我在搜寻这个问题的过程中查看过的文档,下面列出来和大家分享
    anaconda文档

         最省心的Python版本和第三方库管理——初探Anaconda
    Conda:误解与迷思

        关于conda和anaconda不可不知的误解和事实
        Conda: Myths and Misconceptions
        anaconda,conda,pip的关系
        对conda和pip的一点认识

         2、什么叫做包,常用的包有哪几个,每个包的作用是什么?

        从python的官方文档可以看到,模块概念的引入是为了方便代码复用,提高代码的可维护性的。
    如果程序越写越长,那么程序的可读性就会越来越差,程序的 层次结构也会越来越不清晰。这时,
    我们可以把一个较长的程序分成很多容易维护的小文件,其类似于c语言中.h文件和.c文件的作用

         If you quit from the Python interpreter and enter it again, the definitions you have made (functions
    and variables) are lost. Therefore, if you want to write a somewhat longer program, you are better off
    using a text editor to prepare the input for the interpreter and running it with that file as input instead.
    This is known as creating a script. As your program gets longer, you may want to split it into several
    files for easier maintenance. You may also want to use a handy function that you’ve written in several
    programs without copying its definition into each program.

         To support this, Python has a way to put definitions in a file and use them in a script or in an
    interactive instance of the interpreter. Such a file is called a module; definitions from a module can
    be imported into other modules or into the main module (the collection of variables that you have
    access to in a script executed at the top level and in calculator mode).

         而包的概念的引入是为了更方便的组织各个模块,防止相同名称的模块发生冲突,类似于c#或c++中
    的命名空间的作用。比如,两个不同包PA和PB都有同一个名字为M的模块,那么PA.M就表示PA包下面的
    模块M,PB.M就表示PB包下面的模块M

          Packages are a way of structuring Python’s module namespace by using “dotted module names”.
    For example, the module name A.B designates a submodule named B in a package named A. Just like
    the use of modules saves the authors of different modules from having to worry about each other’s
    global variable names, the use of dotted module names saves the authors of multi-module packages
    like NumPy or the Python Imaging Library from having to worry about each other’s module names.
    更多关于包和模块的概念可以阅读下面两篇文章:

         廖雪峰-模块
         python基础-模块和包介绍

         3、如何安装?

        anaconda的安装挺简单的,只要从官方网站下载直接安装就可。pip的安装可以参考下面的文章。
        三步走安装pip
        windows下面安装Python和pip终极教程

         4、python学习资源

         这些资源都是我在网上找到的,仅仅在这里列出来分享一下。

         强烈推荐廖雪峰的官方网站,这真是小白的福音,不管是python2还是python3。里面的内容通俗易
    懂,按照廖雪峰的话说就是

         中文,免费,零起点,完整示例,基于最新的Python 3版本。
         知乎-Python 有哪些好的学习资料或者博客?,这里面有很多牛人提供了各种资源和链接

         code123.cc,这里面提供了许多实践项目,可以帮助我们快速成长。

         27 个机器学习、数学、Python 速查表,这里面包含了许多机器学习和python的资料

         150 多个 ML、NLP 和 Python 相关的教程,这篇文章来自于伯乐在线,这个网站里面也有很多学习
    资源,都非常好。

         python官方文档,当然官方的最权威,不过建议可以当做工具书来查,否则整天看这个不得无聊死!

         网易云课堂,作为国内领先的在线课程学习平台,网易在这方面做的确实挺好。这里面有非常多的
    课程,可以帮助你快速的学习。当然,也有很多慕课平台,不管是国内的还是国内的,里面肯定也有
    很多资源,在此就不在一一列举了。

         结论

         当然,有这么多资源并不能保证你能学会。毕竟,只有真真正的去学你才能真真正正的学会,否则,
    收集了这么多资源也没什么用。其实,很多人有这种通病,有时候心血来潮,想学某个东西,网上下了
    一大堆资料,百度网盘存了一大堆资源,结果也只是放在那里堆灰尘而已,甚至某天发现自己有这么多
    资源的时候还很惊讶!
          说了那么多,其实,最重要的是去做,去行动,去实践。

    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

    该用户从未签到

    3#
    发表于 2018-6-12 15:31:50 | 只看该作者
    学习真不是一件易事儿啊
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    4#
    发表于 2018-6-12 15:32:13 | 只看该作者
    学习真不是一件易事儿啊
    回复 支持 反对

    使用道具 举报

  • TA的每日心情

    2018-5-28 10:15
  • 签到天数: 11 天

    连续签到: 1 天

    [LV.3]测试连长

    5#
    发表于 2018-6-13 15:49:56 | 只看该作者
    感谢你,提供资源
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-9-22 14:37 , Processed in 0.077529 second(s), 25 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表