常用模块学习(一)

常用模块学习(一)

  • 常用模块学习—小鸡汤

推荐节目—晓说:

《晓说》是2012年3月高晓松开始主持的网络脱口秀节目

每期由主持人高晓松谈论一个热门话题,打造视频化的“高晓松专栏文章”

  • 常用模块学习—模块的种类和导入方法

    ‘‘‘
    1、什么是模块?
    在计算机程序的开发过程中,随着程序代码越写越多,在一个文件里代码就会越来越长,越来越不容易维护。
    为了编写可维护的代码,我们把很多函数分组,分别放到不同的文件里,这样,每个文件包含的代码就相对较少,很多编程语言都采用这种组织代码的方式。
    在Python中,一个.py文件就称之为一个模块(Module)。
    
    2、使用模块的好处:
    最大的好处是大大提高了代码的可维护性。
    编写代码不必从零开始,当一个模块编写完毕,就可以被其他地方引用。
    使用模块还可以避免函数名和变量名冲突。
    
    3、模块的分类:
    内置标准模块(又称标准库)执行help(‘modules‘)查看所有python自带模块列表
    第三方开源模块,可通过pip install 模块名 联网安装
    自定义模块
    
    4、模块的调用(模块一旦被调用,即相当于执行了另外一个py文件里的代码):
    import module               导入模块
    from module import xx,xx              从 module 模块中再导入 xx
    from module.xx.xx import xx as rename          as  起别名
    from module.xx.xx import *           * 代表所有,不建议使用,变量名容易冲突
    ‘‘‘
    import os
    import sys
    from os import rmdir
    from os import rmdir,rename      #使用逗号分隔,导入多个
    print(help(‘modules‘))           #查看所有python自带模块列表
    help(‘modules‘)
    Please wait a moment while I gather a list of all available modules...
    __future__          _warnings           http                secrets
    _abc                _weakref            idlelib             select
    _ast                _weakrefset         imaplib             selectors
    _asyncio            _winapi             imghdr              setup
    _bisect             abc                 imp                 setup_cython
    _blake2             aifc                importlib           setuptools
    _bootlocale         antigravity         inspect             shelve
    _bz2                argparse            interpreterInfo     shlex
    _codecs             array               io                  shutil
    _codecs_cn          ast                 ipaddress           signal
    _codecs_hk          asynchat            itertools           site
    _codecs_iso2022     asyncio             json                sitecustomize
    _codecs_jp          asyncore            keyword             smtpd
    _codecs_kr          atexit              lib2to3             smtplib
    _codecs_tw          audioop             linecache           sndhdr
    _collections        backend_interagg    locale              socket
    _collections_abc    base64              logging             socketserver
    _compat_pickle      bdb                 lzma                sqlite3
    _compression        binascii            macpath             sre_compile
    _contextvars        binhex              mailbox             sre_constants
    _csv                bisect              mailcap             sre_parse
    _ctypes             builtins            marshal             ssl
    _ctypes_test        bz2                 math                stat
    _datetime           cProfile            mimetypes           statistics
    _decimal            calendar            mmap                string
    _distutils_findvs   cgi                 modulefinder        stringprep
    _dummy_thread       cgitb               msilib              struct
    _elementtree        chardet             msvcrt              subprocess
    _functools          chunk               multiprocessing     sunau
    _hashlib            cmath               netrc               symbol
    _heapq              cmd                 nntplib             symtable
    _imp                code                nt                  sys
    _io                 codecs              ntpath              sysconfig
    _json               codeop              nturl2path          tabnanny
    _locale             collections         numbers             tarfile
    _lsprof             colorsys            opcode              telnetlib
    _lzma               compileall          operator            tempfile
    _markupbase         concurrent          optparse            test
    _md5                configparser        os                  test_pydevd_reload
    _msi                contextlib          parser              tests_pydevd
    _multibytecodec     contextvars         pathlib             tests_pydevd_mainloop
    _multiprocessing    copy                pdb                 tests_pydevd_python
    _opcode             copyreg             pickle              textwrap
    _operator           crypt               pickletools         this
    _osx_support        csv                 pip                 threading
    _overlapped         ctypes              pipes               time
    _pickle             curses              pkg_resources       timeit
    _py_abc             dataclasses         pkgutil             tkinter
    _pydecimal          datetime            platform            token
    _pydev_bundle       dbm                 plistlib            tokenize
    _pydev_imps         decimal             poplib              trace
    _pydev_runfiles     difflib             posixpath           traceback
    _pydevd_bundle      dis                 pprint              tracemalloc
    _pydevd_frame_eval  distutils           profile             tty
    _pyio               doctest             pstats              turtle
    _queue              dummy_threading     pty                 turtledemo
    _random             easy_install        py_compile          types
    _sha1               email               pyclbr              typing
    _sha256             encodings           pycompletionserver  unicodedata
    _sha3               ensurepip           pydev_app_engine_debug_startup unittest
    _sha512             enum                pydev_coverage      urllib
    _signal             errno               pydev_ipython       uu
    _sitebuiltins       faulthandler        pydev_pysrc         uuid
    _socket             filecmp             pydev_run_in_console venv
    _sqlite3            fileinput           pydevconsole        warnings
    _sre                fnmatch             pydevd              wave
    _ssl                formatter           pydevd_concurrency_analyser weakref
    _stat               fractions           pydevd_file_utils   webbrowser
    _string             ftplib              pydevd_plugins      winreg
    _strptime           functools           pydoc               winsound
    _struct             gc                  pydoc_data          wsgiref
    _symtable           genericpath         pyexpat             xdrlib
    _testbuffer         getopt              queue               xml
    _testcapi           getpass             quopri              xmlrpc
    _testconsole        gettext             random              xxsubtype
    _testimportmultiple glob                re                  zipapp
    _testmultiphase     gzip                reprlib             zipfile
    _thread             hashlib             rlcompleter         zipimport
    _threading_local    heapq               runfiles            zlib
    _tkinter            hmac                runpy
    _tracemalloc        html                sched
    Enter any module name to get more help.  Or, type "modules spam" to search
    for modules whose name or summary contain the string "spam".
  • 常用模块学习—模块的导入路径

#模块一旦被调用,即相当于执行了另外一个py文件里的代码
#自定义模块
#这个最简单, 创建一个.py文件,就可以称之为模块,就可以在另外一个程序里导入
import sys
print(sys.path)
‘‘‘
输出:
[
‘E:\\Python\\work\\myFirstPro\\第4章‘,
‘E:\\Python‘,
‘C:\\Python37\\python37.zip‘,
‘C:\\Python37\\DLLs‘,
‘C:\\Python37\\lib‘,
‘C:\\Python37‘,
‘C:\\Python37\\lib\\site-packages‘,
‘C:\\JetBrains\\PyCharm
2018.2.1\\helpers\\pycharm_matplotlib_backend‘
]

sys.path.append(‘E:\\Python\\work\\myFirstPro\\第4章‘)
print(sys.path)
#import my_modules
#del my_modules

小结:
python解释器会按照列表顺序去依次到每个目录下去匹配你要导入的模块名,
只要在一个目录下匹配到了该模块名,就立刻导入,不再继续往后找。
注意:列表第一个元素为空,即代表当前目录,所以你自己定义的模块在当前目录会被优先导入。
‘‘‘
  • 常用模块学习—开源模块的安装方式

    • 开源模块

https://pypi.python.org/pypi 是python的开源模块库,截止2017年9.30日 ,已经收录了118170个来自全世界python开发者贡献的模块,几乎涵盖了你想用python做的任何事情。 事实上每个python开发者,只要注册一个账号就可以往这个平台上传你自己的模块,这样全世界的开发者都可以容易的下载并使用你的模块。

直接在上面这个页面上点download,下载后,解压并进入目录,执行以下命令完成安装

      编译源码    python setup.py build
      安装源码    python setup.py install

直接通过pip安装

     pip3 install paramiko #paramiko 是模块名   安装     pip3 uninstal paramiko      卸载     import paramiko           使用

pip命令会自动下载模块包并完成安装。

软件一般会被自动安装你python安装目录的这个子目录里

       /your_python_install_path/3.6/lib/python3.6/site-packages
  • 常用模块学习—使用国内源文件下载

pip命令默认会连接在国外的python官方服务器下载,速度比较慢,你还可以使用国内的豆瓣源,数据会定期同步国外官网,速度快好多。

sudo pip install -i http://pypi.douban.com/simple/ alex_sayhi --trusted-host pypi.douban.com   #alex_sayhi是模块名
Microsoft Windows [版本 10.0.17134.285]
(c) 2018 Microsoft Corporation。保留所有权利。

E:\Python>pip3 install PyTyrion
Collecting PyTyrion
  Using cached https://files.pythonhosted.org/packages/c4/22/167ec8e203b0f930582a82a1bfcf7faf9d14af3  Using cached https://files.pythonhosted.org/packages/c4/22/167ec8e203b0f930582a82a1bfc  Using cached https://files.pythonhosted.org/packages/c4/22/167ec8e203b0f930582a82a1b  Using cached https://files.pythonhosted.org/packages/c4/22/167ec8e203b0f930582a82a
  Using cached https://files.pythonhosted.org/packages/c4/22/167ec8e203b0f93058
2a
  Using cached https://files.pythonhosted.org/packages/c4/22/167ec
8b0f930582a82a1bfcf7faf9d14af3a0d6abc807dbb22ed52f8/PyTyrion-1.0.1.tar
e203b0f930582a82a1bfcf7faf9d14af3a0d6abc807dbb22ed52f8/PyTyrion-1.
  Using cached https://files.pythonhosted.org/packages/c4/22/167
ec
8e203b0f930582a82a1bfcf7faf9d14af3a0d6abc807dbb22ed52f8/PyTyrion
-1
  Using cached https://files.pythonhosted.org/packages/c4/22/1
67
ec8e203b0f930582a82a1bfcf7faf9d14af3a0d6abc807dbb22ed52f8/PyTy
ri
  Using cached https://files.pythonhosted.org/packages/c4/22/167ec8e20
3b0f930582a82a1bfcf7faf9d14af3a0d6abc807dbb22ed52f8/PyTyrion-1.0.1.t
ar.gz
Installing collected packages: PyTyrion
  Running setup.py install for PyTyrion ... done
Successfully installed PyTyrion-1.0.1
You are using pip version 10.0.1, however version 18.0 is availabl
eou should consider upgrading via the ‘python -m pip install --upgrad
You are using pip version 10.0.1, however version 18.0 is avai
l.
You are using pip version 10.0.1, however version 18.0 is a
va
You are using pip version 10.0.1, however version 18.0 is a
You are using pip version 10.0.1, however version 18.0
  Running setup.py install for PyTyrion ... done
Successfully installed PyTyrion-1.0.1
You are using pip version 10.0.1, however version 18.0 is
 available.
You should consider upgrading via the ‘python -m pip inst
all --upgrade pip‘ command.

E:\Python>pip3 uninstall PyTyrion
Uninstalling PyTyrion-1.0.1:
  Would remove:
    c:\python37\lib\site-packages\pytyrion-1.0.1-py3.7.eg
g-info
    c:\python37\lib\site-packages\tyrion\*
Proceed (y/n)? y
  Successfully uninstalled PyTyrion-1.0.1
You are using pip version 10.0.1, however version 18.0 is
 available.
You should consider upgrading via the ‘python -m pip inst
all --upgrade pip‘ command.

E:\Python>pip3 install PyTyrion
Collecting PyTyrion
  Using cached https://files.pythonhosted.org/packages/c4/22/167ec8e203b0f930582a82a1bfcf7faf
9d14af3a0d6abc807dbb22ed52f8/PyTyrion-1.0.1.tar.gz
Installing collected packages: PyTyrion
  Running setup.py install for PyTyrion ... done
Successfully installed PyTyrion-1.0.1
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip‘ command.
(venv) E:\Python>pip3 install -i http://pypi.douban.com/simp
le/alex_sayhi --trusted-host pypi.douban.com
You must give at least one requirement to install (see "pip help install")
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip‘ command.

(venv) E:\Python>pip3 install -i http://pypi.douban.com/simp
le/ alex_sayhi --trusted-host pypi.douban.com
Collecting alex_sayhi
  Downloading http://pypi.doubanio.com/packages/84/14/b59d93276c86f6ab556cfa7c2d860b742c1611b601cc
4c7743d129b4b52a/alex_sayhi-1.0.0.tar.gz
Installing collected packages: alex-sayhi
  Running setup.py install for alex-sayhi ... done
Successfully installed alex-sayhi-1.0.0
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip‘ command.

E:\Python>
E:\Python>pip3 install paramiko
Collecting paramiko
  Downloading https://files.pythonhosted.org/packages/3e/db/cb7b6656e0e7387637ce850689084dc0b9
4b44df31cc52e5fc5c2c4fd2c1/paramiko-2.4.1-py2.py3-none-any.whl (194kB)
    78% |█████████████████████████▎      | 153kB 255kB/s eta 0:00:01
    84% |███████████████████████████     | 163kB 255kB/s eta 0:00:0
    89% |████████████████████████████▋   | 174kB 276kB/s eta 0:00
    94% |██████████████████████████████▎ | 184kB 275kB/s eta 0:
    100% |████████████████████████████████| 194kB 383kB/s
Collecting pyasn1>=0.1.7 (from paramiko)
  Downloading https://files.pythonhosted.org/packages/d1/a1/7790cc85db38daa874f6a2e6308131b995
3feb1367f2ae2d1123bb93a9f5/pyasn1-0.4.4-py2.py3-none-any.whl (72kB)
    84% |███████████████████████████     | 61kB 393kB/s eta 0:00:01
    98% |███████████████████████████████▋| 71kB 417kB/s eta 0:
    100% |████████████████████████████████| 81kB 436kB/s
Collecting pynacl>=1.0.1 (from paramiko)
  Downloading https://files.pythonhosted.org/packages/6c/93/29931e02f3add7952f2ea1976960c8a591
a92dcc57a76cd3d736e1c554d0/PyNaCl-1.2.1-cp37-cp37m-win_amd64.whl (165kB)
    80% |█████████████████████████▊      | 133kB 278kB/s eta 0:00:01
    86% |███████████████████████████▋    | 143kB 936kB/s eta 0:00:
    92% |█████████████████████████████▋  | 153kB 655kB/s eta 0:0
    98% |███████████████████████████████▋| 163kB 595kB/s eta 0
    100% |████████████████████████████████| 174kB 936kB/s
Collecting bcrypt>=3.1.3 (from paramiko)
  Downloading https://files.pythonhosted.org/packages/5c/35/5cedb29e9d18108fa54fd383f76e086ad8
ebab9d1d476e8411445c61cccd/bcrypt-3.1.4-cp37-cp37m-win_amd64.whl
Collecting cryptography>=1.5 (from paramiko)
  Downloading https://files.pythonhosted.org/packages/39/dd/43985388f82ac0b4698671e96235c6324b
df14339e21eb3647f4e5b99017/cryptography-2.3.1-cp37-cp37m-win_amd64.whl (1.3MB)
    79% |█████████████████████████▍      | 1.0MB 122kB/s eta 0:00:03
    79% |█████████████████████████▋      | 1.0MB 141kB/s eta 0:00:02
    80% |█████████████████████████▉      | 1.1MB 157kB/s eta 0:00:02
    81% |██████████████████████████      | 1.1MB 133kB/s eta 0:00:02
    82% |██████████████████████████▍     | 1.1MB 138kB/s eta 0:00:0
    83% |██████████████████████████▋     | 1.1MB 101kB/s eta 0:00:0
    83% |██████████████████████████▉     | 1.1MB 101kB/s eta 0:00:0
    84% |███████████████████████████     | 1.1MB 147kB/s eta 0:00:0
    85% |███████████████████████████▍    | 1.1MB 115kB/s eta 0:00:
    86% |███████████████████████████▋    | 1.1MB 114kB/s eta 0:00:
    87% |███████████████████████████▉    | 1.1MB 83kB/s eta 0:00:0
    87% |████████████████████████████    | 1.1MB 77kB/s eta 0:00:0
    88% |████████████████████████████▍   | 1.2MB 82kB/s eta 0:00:
    89% |████████████████████████████▋   | 1.2MB 87kB/s eta 0:00:
    90% |████████████████████████████▉   | 1.2MB 78kB/s eta 0:00:
    90% |█████████████████████████████   | 1.2MB 47kB/s eta 0:00:
    91% |█████████████████████████████▍  | 1.2MB 37kB/s eta 0:00
    92% |█████████████████████████████▋  | 1.2MB 37kB/s eta 0:00
    93% |█████████████████████████████▉  | 1.2MB 31kB/s eta 0:00
    94% |██████████████████████████████  | 1.2MB 27kB/s eta 0:00
    94% |██████████████████████████████▍ | 1.2MB 30kB/s eta 0:0
    95% |██████████████████████████████▋ | 1.2MB 27kB/s eta 0:0
    96% |██████████████████████████████▉ | 1.3MB 27kB/s eta 0:0
    97% |███████████████████████████████ | 1.3MB 25kB/s eta 0:0
    97% |███████████████████████████████▍| 1.3MB 24kB/s eta 0:
    98% |███████████████████████████████▋| 1.3MB 35kB/s eta 0:
    99% |███████████████████████████████▉| 1.3MB 42kB/s eta 0:
    100% |████████████████████████████████| 1.3MB 41kB/s
Collecting cffi>=1.4.1 (from pynacl>=1.0.1->paramiko)
  Downloading https://files.pythonhosted.org/packages/ca/f2/e375b7469a2dfe9d1feac81a10df97f18c
d771b9a10ac62ca9864b760f7c/cffi-1.11.5-cp37-cp37m-win_amd64.whl (165kB)
    80% |█████████████████████████▊      | 133kB 108kB/s eta 0:00:01
    86% |███████████████████████████▋    | 143kB 134kB/s eta 0:00:
    92% |█████████████████████████████▋  | 153kB 139kB/s eta 0:0
    98% |███████████████████████████████▋| 163kB 136kB/s eta 0
    100% |████████████████████████████████| 174kB 161kB/s
Collecting six (from pynacl>=1.0.1->paramiko)
  Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29
a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting asn1crypto>=0.21.0 (from cryptography>=1.5->paramiko)
  Downloading https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad
7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl (101kB)
    90% |█████████████████████████████   | 92kB 212kB/s eta 0:00:
    100% |████████████████████████████████| 102kB 220kB/s
Collecting idna>=2.1 (from cryptography>=1.5->paramiko)
  Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a
97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
    87% |████████████████████████████▏   | 51kB 234kB/s eta 0:00:
    100% |████████████████████████████████| 61kB 262kB/s
Collecting pycparser (from cffi>=1.4.1->pynacl>=1.0.1->paramiko)
  Downloading https://files.pythonhosted.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177ad
cc2073d36a17b1491fd09df6ed/pycparser-2.18.tar.gz (245kB)
    79% |█████████████████████████▎      | 194kB 361kB/s eta 0:00:01
    83% |██████████████████████████▋     | 204kB 278kB/s eta 0:00:0
    87% |████████████████████████████    | 215kB 248kB/s eta 0:00:
    91% |█████████████████████████████▎  | 225kB 249kB/s eta 0:0
    95% |██████████████████████████████▋ | 235kB 239kB/s eta 0:
    99% |████████████████████████████████| 245kB 239kB/s eta 0
    100% |████████████████████████████████| 256kB 292kB/s
Installing collected packages: pyasn1, pycparser, cffi, six, pynacl, bcrypt, asn1crypto, idna,
 cryptography, paramiko
  Running setup.py install for pycparser ... done
Successfully installed asn1crypto-0.24.0 bcrypt-3.1.4 cffi-1.11.5 cryptography-2.3.1 idna-2.7
paramiko-2.4.1 pyasn1-0.4.4 pycparser-2.18 pynacl-1.2.1 six-1.11.0
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip‘ command.

使用国内豆瓣源下载速度对比:
Microsoft Windows [版本 10.0.17134.285]
(c) 2018 Microsoft Corporation。保留所有权利。

E:\Python>pip3 install -i http://pypi.douban.com/simple/ paramiko
Looking in indexes: http://pypi.douban.com/simple/
Collecting paramiko
  The repository located at pypi.douban.com is not a trusted or secure host and is being
 ignored. If this repository is available via HTTPS we recommend you use HTTPS instead  The repository located at pypi.douban.com is not a trusted or secure host and i
s
being ignored. If this repository is available via HTTPS we recommend you use HTT
PS
 instead, otherwise you may silence this warning and allow it anyway with ‘--trus
  The repository located at pypi.douban.com is not a trusted or secure host an
d i
s being ignored. If this repository is available via HTTPS we recommend you us
e H
TTPS instead, otherwise you may silence this warning and allow it anyway with
  The repository located at pypi.douban.com is not a trusted or sec
ure
 host and is being ignored. If this repository is available via HTT
PS
we recommend you use HTTPS instead, otherwise you may silence this
war
  The repository located at pypi.douban.com is not a trusted or s
ec
ure host and is being ignored. If this repository is available vi
a
HTTPS we recommend you use HTTPS instead, otherwise you may silen
ce
 this warning and allow it anyway with ‘--trusted-host pypi.douba
n.
com‘.
HTTPS we recommend you use HTTPS instead, otherwise you may si
len
ce this warning and allow it anyway with ‘--trusted-host pypi.
dou
ban.com‘.
HTTPS we recommend you use HTTPS instead, otherwise you may
may silence this warning and allow it anyway with ‘--tr
ust pypi.douban.com‘.
sted-host pypi.douban.com‘.
  Could not find a version that satisfies the requireme
 may silence this warning and allow it anyway with
 ‘--t
rusted-host pypi.douban.com‘.
HTTPS we recommend you use HTTPS instead, otherw
is
e you may silence this warning and allow it anyw
ay
 with ‘--trusted-host pypi.douban.com‘.
HTTPS we recommend you use HTTPS instead,
ot
herwise you may silence this warning and a
ll
ow it anyway with ‘--trusted-host pypi.dou
ba
n.com‘.
  Could not find a version that satisfies
herwise you may silence this warning and
a requirement paramiko (from versions: )
llow it anyway with ‘--trusted-host pypi.
d
ouban.com‘.
  Could not find a version that satisfies
the requirement paramiko (from versions:
)ou should consider upgrading via the ‘pyt

No matching distribution found for parami
 the requirement paramiko (from versions
:
 )
No matching distribution found for param
  Could not find a version that satisfies the requirement paramiko (from versions:
 )
No matching distribution found for paramiko
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the ‘python -m pip install --upgra
You are using pip version 10.0.1, however version 18.0 is availab
lou should consider upgrading via the ‘python -m pip install --upg
You are using pip version 10.0.1, however version 18.0 is avail
ab
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip‘ comma
You are using pip version 10.0.1, however version 18.0 is availa
b
You are using pip version 10.0.1, however version 18
.0
You are using pip version 10.0.1, however vers
i 18.0 is available.
You are using pip version 10.0.1, however ve
ron 18.0 is available.
You are using pip version 10.0.1, however
version 18.0 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip‘ command.

E:\Python>pip3 install -i http://pypi.douban.com/simple/ paramiko --trusted-host pypi.douban.com
Looking in indexes: http://pypi.douban.com/simple/
Collecting paramiko
  Downloading http://pypi.doubanio.com/packages/3e/db/cb7b6656e0e7387637ce850689084dc0b94b44df31cc52e5fc5c2c4fd2c1/paramiko-
2.4.1-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 655kB/s
Requirement already satisfied: pynacl>=1.0.1 in c:\python37\lib\site-packages (from paramiko) (1.2.1)
Requirement already satisfied: pyasn1>=0.1.7 in c:\python37\lib\site-packages (from paramiko) (0.4.4)
Requirement already satisfied: cryptography>=1.5 in c:\python37\lib\site-packages (from paramiko) (2.3.1)
Requirement already satisfied: bcrypt>=3.1.3 in c:\python37\lib\site-packages (from paramiko) (3.1.4)
Requirement already satisfied: cffi>=1.4.1 in c:\python37\lib\site-packages (from pynacl>=1.0.1->paramiko) (1.11.5)
Requirement already satisfied: six in c:\python37\lib\site-packages (from pynacl>=1.0.1->paramiko) (1.11.0)
Requirement already satisfied: idna>=2.1 in c:\python37\lib\site-packages (from cryptography>=1.5->paramiko) (2.7)
Requirement already satisfied: asn1crypto>=0.21.0 in c:\python37\lib\site-packages (from cryptography>=1.5->paramiko) (Requirement already satisfied: idna>=2.1 in c:\python37\lib\site-packages (from cryptography>=1.5->pa
ramiko) (2.7)
Requirement already satisfied: idna>=2.1 in c:\python37\lib\site
-p
ackages (from cryptography>=1.5->paramiko) (2.7)
Requirement already satisfied: asn1crypto>=0.21.0 in c:\python37
\l
ib\site-packages (from cryptography>=1.5->paramiko) (0.24.0)
Requirement already satisfied: pycparser in c:\python37\lib\site
Requirement already satisfied: asn1crypto>=0.21.0 in c:plib\site-packages (from cryptography>=1.5->paramiko) (0.24.0)
ython37\lib\site-packages (from cryptography>=1.5->param
ipackages (from cffi>=1.4.1->pynacl>=1.0.1->paramiko) (2.18)
ko) (0.24.0)
Requirement already satisfied: pycparser in c:\python37lou are using pip version 10.0.1, however version 18.0 is availa
ib\site-packages (from cffi>=1.4.1->pynacl>=1.0.1->param
iou should consider upgrading via the ‘python -m pip install --u
Requirement already satisfied: pycparser
in c:\python37\lib\site-packages (from
 cffi>=1.4.1->pynacl>=1.0.1->paramik
o) (2.18)
Installing collected packages: paramiko
Successfully installed paramiko-2.4.1
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip‘ command.

原文地址:https://www.cnblogs.com/wqq0723/p/9660284.html

时间: 2024-11-08 21:37:29

常用模块学习(一)的相关文章

Day5 - Python基础5 常用模块学习

Python 之路 Day5 - 常用模块学习 本节大纲: 模块介绍 time &datetime模块 random os sys shutil json & picle shelve xml处理 yaml处理 configparser hashlib subprocess logging模块 re正则表达式 模块,用一砣代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合.而对于一个复杂的功能来,

Python-Day5 常用模块学习

一.模块介绍 通俗点说,就是把常用的一些功能单独放置到一个.py文件中,方便其他文件来调用,这样的一个文件可以称为一个模块. 模块分为三种: 自定义模块 内置标准模块(又称标准库) 开源模块 二.导入模块 Python之所以应用越来越广泛,在一定程度上也依赖于其为程序员提供了大量的模块以供使用,如果想要使用模块,则需要导入.导入模块有一下几种方法: import module from module.xx.xx import xx from module.xx.xx import xx as r

Day5 - 常用模块学习

本节大纲: 模块介绍(模块导入方法) time &datetime模块 random os sys shutil json & picle shelve xml处理 yaml处理 configparser hashlib subprocess logging模块 re正则表达式 模块,用一堆代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合.而对于一个复杂的功能来,可能需要多个函数才能完成(函数又

Python之路-python(常用模块学习)

模块介绍 time &datetime模块 random os sys shutil shelve xml处理 yaml处理 configparser hashlib re正则表达式 1.模块: 定义:其实模块简单说就是一堆代码实现某个功能,它们是已经写好的.py文件.只需要用import应用即可. 分类: 1.自定义模块 2.内置标准模块(又称标准库) 3.开源模块    1.自定义模块,就是自己写的.py文件为了实现某个功能.    2.内置模块,就是python自身已经写好的某个功能,例如

Python自动化基础【day05】:Python常用模块学习

本节大纲: 模块介绍 time &datetime模块 random os sys shutil json & picle shelve xml处理 yaml处理 configparser hashlib subprocess logging模块 re正则表达式 模块介绍 模块,用一砣代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合.而对于一个复杂的功能来,可能需要多个函数才能完成(函数又可以在

python学习笔记day5——常用模块学习

一.主要内容 模块介绍 time &datetime模块 random os sys shutil json & picle shelve xml处理 yaml处理 configparser hashlib subprocess logging模块 re正则表达式 二.具体内容 1.模块 a.定义:本质就是.py结尾的python文件,逻辑上组织python代码,实现某种功能.例:文件名test.py-->模块名test. b.导入方法:imort moduname from mdn

Python 常用模块学习

一.什么是模块 Python中的模块是可以将代码量较大的程序分割成多个有组织的.彼此独立但又能互相交互的代码片段,这些自我包含的有组织的代码段就是模块.Python允许"导入"其他模块以实现代码重用,从而也实现了将独立的代码文件组织成更大的程序系统.Python中,模块也是对象.在一个模块的顶层定义的所有变量都在被导入时成为了被导入模块的属性. 二.模块的使用 1.python程序架构一个Python程序通常包括一个顶层程序文件和若干个模块文件.顶层文件包含了程序的主要控制流程,模块文

Python 之路 Day5 - 常用模块学习

本节大纲: 模块介绍 time &datetime模块 random os sys shutil json & picle shelve xml处理 yaml处理 configparser hashlib subprocess logging模块 re正则表达式 模块,用一砣代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合.而对于一个复杂的功能来,可能需要多个函数才能完成(函数又可以在不同的.p

Python常用模块学习

1.模块介绍 2.time & datetime模块 3.random 4.os 5.sys 6.shutil 7.json&pickle 8.shelve 9.xml处理 10.yaml处理 11.configparser 12.hashlib 13.subprocess 14.logging模块 15.re正则表达式 1.模块 模块,就是用一坨代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合