RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题 / 807199
Accepted
Tanya
Tanya
Asked:2020-03-30 23:11:42 +0000 UTC2020-03-30 23:11:42 +0000 UTC 2020-03-30 23:11:42 +0000 UTC

为什么 python3 -v 提供有关清理和销毁库的信息?

  • 772

我认为 -v 是 --version 开关的简写。事实证明,对于--version,有-V。但是命令已经输入了,我有一个问题。

输入后出现:

import _frozen_importlib # frozen
import _imp # builtin
import sys # builtin
import '_warnings' # <class '_frozen_importlib.BuiltinImporter'>
import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
import '_frozen_importlib_external' # <class '_frozen_importlib.FrozenImporter'>
import '_io' # <class '_frozen_importlib.BuiltinImporter'>
import 'marshal' # <class '_frozen_importlib.BuiltinImporter'>
import 'posix' # <class '_frozen_importlib.BuiltinImporter'>
import _thread # previously loaded ('_thread')
import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
import _weakref # previously loaded ('_weakref')
import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
# installing zipimport hook
import 'zipimport' # <class '_frozen_importlib.BuiltinImporter'>
# installed zipimport hook
# /usr/lib/python3.6/encodings/__pycache__/__init__.cpython-36.pyc matches /usr/lib/python3.6/encodings/__init__.py
# code object from '/usr/lib/python3.6/encodings/__pycache__/__init__.cpython-36.pyc'
# /usr/lib/python3.6/__pycache__/codecs.cpython-36.pyc matches /usr/lib/python3.6/codecs.py
# code object from '/usr/lib/python3.6/__pycache__/codecs.cpython-36.pyc'
import '_codecs' # <class '_frozen_importlib.BuiltinImporter'>
import 'codecs' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df42f470>
# /usr/lib/python3.6/encodings/__pycache__/aliases.cpython-36.pyc matches /usr/lib/python3.6/encodings/aliases.py
# code object from '/usr/lib/python3.6/encodings/__pycache__/aliases.cpython-36.pyc'
import 'encodings.aliases' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df43de10>
import 'encodings' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df4a2f98>
# /usr/lib/python3.6/encodings/__pycache__/utf_8.cpython-36.pyc matches /usr/lib/python3.6/encodings/utf_8.py
# code object from '/usr/lib/python3.6/encodings/__pycache__/utf_8.cpython-36.pyc'
import 'encodings.utf_8' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df44ac18>
import '_signal' # <class '_frozen_importlib.BuiltinImporter'>
# /usr/lib/python3.6/encodings/__pycache__/latin_1.cpython-36.pyc matches /usr/lib/python3.6/encodings/latin_1.py
# code object from '/usr/lib/python3.6/encodings/__pycache__/latin_1.cpython-36.pyc'
import 'encodings.latin_1' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df452748>
# /usr/lib/python3.6/__pycache__/io.cpython-36.pyc matches /usr/lib/python3.6/io.py
# code object from '/usr/lib/python3.6/__pycache__/io.cpython-36.pyc'
# /usr/lib/python3.6/__pycache__/abc.cpython-36.pyc matches /usr/lib/python3.6/abc.py
# code object from '/usr/lib/python3.6/__pycache__/abc.cpython-36.pyc'
# /usr/lib/python3.6/__pycache__/_weakrefset.cpython-36.pyc matches /usr/lib/python3.6/_weakrefset.py
# code object from '/usr/lib/python3.6/__pycache__/_weakrefset.cpython-36.pyc'
import '_weakrefset' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df4566d8>
import 'abc' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df452d30>
import 'io' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df452978>
# /usr/lib/python3.6/__pycache__/site.cpython-36.pyc matches /usr/lib/python3.6/site.py
# code object from '/usr/lib/python3.6/__pycache__/site.cpython-36.pyc'
# /usr/lib/python3.6/__pycache__/os.cpython-36.pyc matches /usr/lib/python3.6/os.py
# code object from '/usr/lib/python3.6/__pycache__/os.cpython-36.pyc'
import 'errno' # <class '_frozen_importlib.BuiltinImporter'>
# /usr/lib/python3.6/__pycache__/stat.cpython-36.pyc matches /usr/lib/python3.6/stat.py
# code object from '/usr/lib/python3.6/__pycache__/stat.cpython-36.pyc'
import '_stat' # <class '_frozen_importlib.BuiltinImporter'>
import 'stat' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df3f9a58>
# /usr/lib/python3.6/__pycache__/posixpath.cpython-36.pyc matches /usr/lib/python3.6/posixpath.py
# code object from '/usr/lib/python3.6/__pycache__/posixpath.cpython-36.pyc'
# /usr/lib/python3.6/__pycache__/genericpath.cpython-36.pyc matches /usr/lib/python3.6/genericpath.py
# code object from '/usr/lib/python3.6/__pycache__/genericpath.cpython-36.pyc'
import 'genericpath' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df404470>
import 'posixpath' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df400160>
# /usr/lib/python3.6/__pycache__/_collections_abc.cpython-36.pyc matches /usr/lib/python3.6/_collections_abc.py
# code object from '/usr/lib/python3.6/__pycache__/_collections_abc.cpython-36.pyc'
import '_collections_abc' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df404ac8>
import 'os' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df3ed390>
# /usr/lib/python3.6/__pycache__/_sitebuiltins.cpython-36.pyc matches /usr/lib/python3.6/_sitebuiltins.py
# code object from '/usr/lib/python3.6/__pycache__/_sitebuiltins.cpython-36.pyc'
import '_sitebuiltins' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df3ed780>
# /usr/lib/python3.6/__pycache__/sysconfig.cpython-36.pyc matches /usr/lib/python3.6/sysconfig.py
# code object from '/usr/lib/python3.6/__pycache__/sysconfig.cpython-36.pyc'
import 'sysconfig' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df3b6f28>
# /usr/lib/python3.6/__pycache__/_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.pyc matches /usr/lib/python3.6/_sysconfigdata_m_linux_x86_64-linux-gnu.py
# code object from '/usr/lib/python3.6/__pycache__/_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.pyc'
import '_sysconfigdata_m_linux_x86_64-linux-gnu' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df3d07f0>
# /usr/lib/python3.6/__pycache__/_bootlocale.cpython-36.pyc matches /usr/lib/python3.6/_bootlocale.py
# code object from '/usr/lib/python3.6/__pycache__/_bootlocale.cpython-36.pyc'
import '_locale' # <class '_frozen_importlib.BuiltinImporter'>
import '_bootlocale' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df3de7f0>
# /usr/lib/python3.6/__pycache__/types.cpython-36.pyc matches /usr/lib/python3.6/types.py
# code object from '/usr/lib/python3.6/__pycache__/types.cpython-36.pyc'
# /usr/lib/python3.6/__pycache__/functools.cpython-36.pyc matches /usr/lib/python3.6/functools.py
# code object from '/usr/lib/python3.6/__pycache__/functools.cpython-36.pyc'
import '_functools' # <class '_frozen_importlib.BuiltinImporter'>
# /usr/lib/python3.6/collections/__pycache__/__init__.cpython-36.pyc matches /usr/lib/python3.6/collections/__init__.py
# code object from '/usr/lib/python3.6/collections/__pycache__/__init__.cpython-36.pyc'
# /usr/lib/python3.6/__pycache__/operator.cpython-36.pyc matches /usr/lib/python3.6/operator.py
# code object from '/usr/lib/python3.6/__pycache__/operator.cpython-36.pyc'
import '_operator' # <class '_frozen_importlib.BuiltinImporter'>
import 'operator' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df39b5f8>
# /usr/lib/python3.6/__pycache__/keyword.cpython-36.pyc matches /usr/lib/python3.6/keyword.py
# code object from '/usr/lib/python3.6/__pycache__/keyword.cpython-36.pyc'
import 'keyword' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df3a1860>
# /usr/lib/python3.6/__pycache__/heapq.cpython-36.pyc matches /usr/lib/python3.6/heapq.py
# code object from '/usr/lib/python3.6/__pycache__/heapq.cpython-36.pyc'
import '_heapq' # <class '_frozen_importlib.BuiltinImporter'>
import 'heapq' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df3a40b8>
import 'itertools' # <class '_frozen_importlib.BuiltinImporter'>
# /usr/lib/python3.6/__pycache__/reprlib.cpython-36.pyc matches /usr/lib/python3.6/reprlib.py
# code object from '/usr/lib/python3.6/__pycache__/reprlib.cpython-36.pyc'
import 'reprlib' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df39ed68>
import '_collections' # <class '_frozen_importlib.BuiltinImporter'>
import 'collections' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df374cc0>
# /usr/lib/python3.6/__pycache__/weakref.cpython-36.pyc matches /usr/lib/python3.6/weakref.py
# code object from '/usr/lib/python3.6/__pycache__/weakref.cpython-36.pyc'
import 'weakref' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df37c0f0>
import 'functools' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df3e94a8>
# /usr/lib/python3.6/collections/__pycache__/abc.cpython-36.pyc matches /usr/lib/python3.6/collections/abc.py
# code object from '/usr/lib/python3.6/collections/__pycache__/abc.cpython-36.pyc'
import 'collections.abc' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df3740b8>
import 'types' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df3e47f0>
# /usr/lib/python3.6/importlib/__pycache__/__init__.cpython-36.pyc matches /usr/lib/python3.6/importlib/__init__.py
# code object from '/usr/lib/python3.6/importlib/__pycache__/__init__.cpython-36.pyc'
# /usr/lib/python3.6/__pycache__/warnings.cpython-36.pyc matches /usr/lib/python3.6/warnings.py
# code object from '/usr/lib/python3.6/__pycache__/warnings.cpython-36.pyc'
import 'warnings' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df36e550>
import 'importlib' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df3e4a20>
# /usr/lib/python3.6/importlib/__pycache__/util.cpython-36.pyc matches /usr/lib/python3.6/importlib/util.py
# code object from '/usr/lib/python3.6/importlib/__pycache__/util.cpython-36.pyc'
# /usr/lib/python3.6/importlib/__pycache__/abc.cpython-36.pyc matches /usr/lib/python3.6/importlib/abc.py
# code object from '/usr/lib/python3.6/importlib/__pycache__/abc.cpython-36.pyc'
# /usr/lib/python3.6/importlib/__pycache__/machinery.cpython-36.pyc matches /usr/lib/python3.6/importlib/machinery.py
# code object from '/usr/lib/python3.6/importlib/__pycache__/machinery.cpython-36.pyc'
import 'importlib.machinery' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df3549e8>
import 'importlib.abc' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df354320>
# /usr/lib/python3.6/__pycache__/contextlib.cpython-36.pyc matches /usr/lib/python3.6/contextlib.py
# code object from '/usr/lib/python3.6/__pycache__/contextlib.cpython-36.pyc'
import 'contextlib' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df362438>
import 'importlib.util' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df346c88>
# destroy mpl_toolkits
# possible namespace for /usr/lib/python3/dist-packages/ruamel
# /usr/lib/python3.6/__pycache__/sitecustomize.cpython-36.pyc matches /usr/lib/python3.6/sitecustomize.py
# code object from '/usr/lib/python3.6/__pycache__/sitecustomize.cpython-36.pyc'
import 'sitecustomize' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df2f5e48>
import 'site' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df469048>
Python 3.6.4+ (default, Feb 12 2018, 08:25:03) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
# extension module 'readline' loaded from '/usr/lib/python3.6/lib-dynload/readline.cpython-36m-x86_64-linux-gnu.so'
# extension module 'readline' executed from '/usr/lib/python3.6/lib-dynload/readline.cpython-36m-x86_64-linux-gnu.so'
import 'readline' # <_frozen_importlib_external.ExtensionFileLoader object at 0x7fa4df303a20>
import 'atexit' # <class '_frozen_importlib.BuiltinImporter'>
# /usr/lib/python3.6/__pycache__/rlcompleter.cpython-36.pyc matches /usr/lib/python3.6/rlcompleter.py
# code object from '/usr/lib/python3.6/__pycache__/rlcompleter.cpython-36.pyc'
import 'rlcompleter' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa4df303b38>

在我输入exit()之后,我得到了这个:

# clear builtins._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# clear sys.__interactivehook__
# clear sys.flags
# clear sys.float_info
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup[2] removing builtins
# cleanup[2] removing sys
# cleanup[2] removing _frozen_importlib
# cleanup[2] removing _imp
# cleanup[2] removing _warnings
# cleanup[2] removing _thread
# cleanup[2] removing _weakref
# cleanup[2] removing _frozen_importlib_external
# cleanup[2] removing _io
# cleanup[2] removing marshal
# cleanup[2] removing posix
# cleanup[2] removing zipimport
# cleanup[2] removing encodings
# destroy encodings
# cleanup[2] removing codecs
# cleanup[2] removing _codecs
# cleanup[2] removing encodings.aliases
# cleanup[2] removing encodings.utf_8
# cleanup[2] removing _signal
# cleanup[2] removing __main__
# cleanup[2] removing encodings.latin_1
# cleanup[2] removing io
# destroy io
# cleanup[2] removing abc
# cleanup[2] removing _weakrefset
# destroy _weakrefset
# cleanup[2] removing site
# destroy site
# cleanup[2] removing os
# cleanup[2] removing errno
# cleanup[2] removing stat
# cleanup[2] removing _stat
# cleanup[2] removing posixpath
# cleanup[2] removing genericpath
# cleanup[2] removing os.path
# cleanup[2] removing _collections_abc
# cleanup[2] removing _sitebuiltins
# cleanup[2] removing sysconfig
# destroy sysconfig
# cleanup[2] removing _sysconfigdata_m_linux_x86_64-linux-gnu
# destroy _sysconfigdata_m_linux_x86_64-linux-gnu
# cleanup[2] removing _bootlocale
# destroy _bootlocale
# cleanup[2] removing _locale
# cleanup[2] removing types
# cleanup[2] removing functools
# cleanup[2] removing _functools
# cleanup[2] removing collections
# cleanup[2] removing operator
# destroy operator
# cleanup[2] removing _operator
# cleanup[2] removing keyword
# destroy keyword
# cleanup[2] removing heapq
# cleanup[2] removing _heapq
# cleanup[2] removing itertools
# cleanup[2] removing reprlib
# destroy reprlib
# cleanup[2] removing _collections
# cleanup[2] removing weakref
# destroy weakref
# cleanup[2] removing collections.abc
# cleanup[2] removing importlib
# destroy importlib
# cleanup[2] removing importlib._bootstrap
# cleanup[2] removing importlib._bootstrap_external
# cleanup[2] removing warnings
# cleanup[2] removing importlib.util
# cleanup[2] removing importlib.abc
# cleanup[2] removing importlib.machinery
# cleanup[2] removing contextlib
# destroy contextlib
# cleanup[2] removing mpl_toolkits
# destroy mpl_toolkits
# cleanup[2] removing ruamel
# destroy ruamel
# cleanup[2] removing sitecustomize
# destroy sitecustomize
# cleanup[2] removing readline
# cleanup[2] removing atexit
# cleanup[2] removing rlcompleter
# destroy rlcompleter
# destroy zipimport
# destroy _signal
# destroy _sitebuiltins
# destroy errno
# destroy posixpath
# destroy _stat
# destroy genericpath
# destroy stat
# destroy os
# destroy _locale
# destroy _functools
# destroy heapq
# destroy collections.abc
# destroy atexit
# destroy __main__
# destroy readline
# destroy _operator
# destroy _heapq
# destroy _collections
# destroy collections
# destroy itertools
# destroy importlib.util
# destroy importlib.abc
# destroy functools
# destroy types
# destroy warnings
# destroy importlib.machinery
# destroy abc
# destroy _collections_abc
# cleanup[3] wiping _frozen_importlib
# destroy _frozen_importlib_external
# cleanup[3] wiping _imp
# cleanup[3] wiping _warnings
# cleanup[3] wiping _thread
# cleanup[3] wiping _weakref
# cleanup[3] wiping _io
# cleanup[3] wiping marshal
# cleanup[3] wiping posix
# cleanup[3] wiping codecs
# cleanup[3] wiping _codecs
# cleanup[3] wiping encodings.aliases
# cleanup[3] wiping encodings.utf_8
# cleanup[3] wiping encodings.latin_1
# cleanup[3] wiping importlib._bootstrap
# cleanup[3] wiping sys
# cleanup[3] wiping builtins

在man python3其中写道,密钥-v执行以下操作:

每次初始化模块时打印一条消息,指示加载它的位置(文件名或内置模块)。还提供有关在退出时清理模块的信息。

“擦拭”和“破坏”这两个词让我感到困惑。这个输出是否意味着某些东西被破坏了,因为如果你尝试导入一个被破坏的模块,它会正常导入。谁来说明情况?

python
  • 1 1 个回答
  • 10 Views

1 个回答

  • Voted
  1. Best Answer
    Evgeniy Shubin
    2020-03-30T23:27:05Z2020-03-30T23:27:05Z

    摘自 python3 手册页:

    -v     Print a message each time a module is initialized, showing the place (filename or built-in module) from which it is loaded.  When given twice, print a message for each file that is  checked  for  when
           searching for a module.  Also provides information on module cleanup at exit.
    

    简而言之,此模式显示了导入模块的加载位置。

    • 0

相关问题

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    是否可以在 C++ 中继承类 <---> 结构?

    • 2 个回答
  • Marko Smith

    这种神经网络架构适合文本分类吗?

    • 1 个回答
  • Marko Smith

    为什么分配的工作方式不同?

    • 3 个回答
  • Marko Smith

    控制台中的光标坐标

    • 1 个回答
  • Marko Smith

    如何在 C++ 中删除类的实例?

    • 4 个回答
  • Marko Smith

    点是否属于线段的问题

    • 2 个回答
  • Marko Smith

    json结构错误

    • 1 个回答
  • Marko Smith

    ServiceWorker 中的“获取”事件

    • 1 个回答
  • Marko Smith

    c ++控制台应用程序exe文件[重复]

    • 1 个回答
  • Marko Smith

    按多列从sql表中选择

    • 1 个回答
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Suvitruf - Andrei Apanasik 什么是空? 2020-08-21 01:48:09 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5