关闭

python -v显示一大串信息后如何退出呢

来源:网络 文章列表 2019-07-03 8
对于新手想看下自己机器里的Python版本,自然想到python -v命令。结果输入python -v显示这些了一长串以下信息。exit可以推出当前的Python程序窗口。

对于新手想看下自己机器里的Python版本,自然想到python -v命令。结果输入python -v显示这些了一长串以下信息

C:\Users\Administrators>python -v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
import site # from C:\Program Files\python\lib\site.py
# can't create C:\Program Files\python\lib\site.pyc
import os # from C:\Program Files\python\lib\os.py
# can't create C:\Program Files\python\lib\os.pyc
import errno # builtin
import nt # builtin
import ntpath # from C:\Program Files\python\lib\ntpath.py
# can't create C:\Program Files\python\lib\ntpath.pyc
import stat # from C:\Program Files\python\lib\stat.py
# can't create C:\Program Files\python\lib\stat.pyc
import genericpath # from C:\Program Files\python\lib\genericpath.py
# can't create C:\Program Files\python\lib\genericpath.pyc
import warnings # from C:\Program Files\python\lib\warnings.py
# can't create C:\Program Files\python\lib\warnings.pyc
import linecache # from C:\Program Files\python\lib\linecache.py
# can't create C:\Program Files\python\lib\linecache.pyc
import types # from C:\Program Files\python\lib\types.py
# can't create C:\Program Files\python\lib\types.pyc
import UserDict # from C:\Program Files\python\lib\UserDict.py
# can't create C:\Program Files\python\lib\UserDict.pyc
import _abcoll # from C:\Program Files\python\lib\_abcoll.py
# can't create C:\Program Files\python\lib\_abcoll.pyc
import abc # from C:\Program Files\python\lib\abc.py
# can't create C:\Program Files\python\lib\abc.pyc
import _weakrefset # from C:\Program Files\python\lib\_weakrefset.py
# can't create C:\Program Files\python\lib\_weakrefset.pyc
import _weakref # builtin
import copy_reg # from C:\Program Files\python\lib\copy_reg.py
# can't create C:\Program Files\python\lib\copy_reg.pyc
import traceback # from C:\Program Files\python\lib\traceback.py
# can't create C:\Program Files\python\lib\traceback.pyc
import sysconfig # from C:\Program Files\python\lib\sysconfig.py
# can't create C:\Program Files\python\lib\sysconfig.pyc
import re # from C:\Program Files\python\lib\re.py
# can't create C:\Program Files\python\lib\re.pyc
import sre_compile # from C:\Program Files\python\lib\sre_compile.py
# can't create C:\Program Files\python\lib\sre_compile.pyc
import _sre # builtin
import sre_parse # from C:\Program Files\python\lib\sre_parse.py
# can't create C:\Program Files\python\lib\sre_parse.pyc
import sre_constants # from C:\Program Files\python\lib\sre_constants.py
# can't create C:\Program Files\python\lib\sre_constants.pyc
import _locale # builtin
import locale # from C:\Program Files\python\lib\locale.py
# can't create C:\Program Files\python\lib\locale.pyc
import encodings # directory C:\Program Files\python\lib\encodings
import encodings # from C:\Program Files\python\lib\encodings\__init__.py
# can't create C:\Program Files\python\lib\encodings\__init__.pyc
import codecs # from C:\Program Files\python\lib\codecs.py
# can't create C:\Program Files\python\lib\codecs.pyc
import _codecs # builtin
import encodings.aliases # from C:\Program Files\python\lib\encodings\aliases.py
# can't create C:\Program Files\python\lib\encodings\aliases.pyc
import operator # builtin
import functools # from C:\Program Files\python\lib\functools.py
# can't create C:\Program Files\python\lib\functools.pyc
import _functools # builtin
import encodings.gbk # from C:\Program Files\python\lib\encodings\gbk.py
# can't create C:\Program Files\python\lib\encodings\gbk.pyc
import _codecs_cn # builtin
import _multibytecodec # builtin
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

而且更可恶的是,程序一直处在

>>>

的界面,按esc,ctrl+c之类都无法退出,

此时怎么办呢?

其实很简单,执行一下命令即可

exit()

exit可以推出当前的Python程序窗口。

那么,萌新可能要问,那怎么查看Python的版本呢

答案就是

python -V

同样是v,但是是大写的v。小写的v,会显示本地python的版本信息,包括库版本

阿里云618优惠卷大放送

版权声明

本站部分原创文章,部分文章整理自网络。如有转载的文章侵犯了您的版权,请联系站长删除处理。如果您有优质文章,欢迎发稿给我们!联系站长:
愿本站的内容能为您的学习、工作带来绵薄之力。

评论

  • 随机获取
点击刷新
精彩评论