英文:
Python in command prompt is showing extra "information"
问题
这只会在我输入 -v 的时候发生。我能做些什么,或者我应该使用不同版本的 Python 来解决这个问题?
英文:
This is a very strange error (?) of sorts, I think my python still works, it's just a very weird thing. I just downloaded Python 3.11.3 from here and checked the box to add Python to path. I also removed the environment variable and added it back, and I'm still getting this sortof error. Whenever I type in python -v
into the command prompt, I get this code here, and then finally the python version:
import _frozen_importlib # frozen
import _imp # builtin
import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
import '_warnings' # <class '_frozen_importlib.BuiltinImporter'>
import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
import 'winreg' # <class '_frozen_importlib.BuiltinImporter'>
import '_io' # <class '_frozen_importlib.BuiltinImporter'>
import 'marshal' # <class '_frozen_importlib.BuiltinImporter'>
import 'nt' # <class '_frozen_importlib.BuiltinImporter'>
import '_frozen_importlib_external' # <class '_frozen_importlib.FrozenImporter'>
# installing zipimport hook
import 'time' # <class '_frozen_importlib.BuiltinImporter'>
import 'zipimport' # <class '_frozen_importlib.FrozenImporter'>
# installed zipimport hook
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\encodings\__pycache__\__init__.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\encodings\__init__.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\encodings\\__pycache__\\__init__.cpython-311.pyc'
import '_codecs' # <class '_frozen_importlib.BuiltinImporter'>
import 'codecs' # <class '_frozen_importlib.FrozenImporter'>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\encodings\__pycache__\aliases.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\encodings\aliases.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\encodings\\__pycache__\\aliases.cpython-311.pyc'
import 'encodings.aliases' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51B6E9D0>
import 'encodings' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51B672D0>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\encodings\__pycache__\utf_8.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\encodings\utf_8.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\encodings\\__pycache__\\utf_8.cpython-311.pyc'
import 'encodings.utf_8' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51B926D0>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\encodings\__pycache__\cp1252.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1252.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\encodings\\__pycache__\\cp1252.cpython-311.pyc'
import 'encodings.cp1252' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51B92CD0>
import '_signal' # <class '_frozen_importlib.BuiltinImporter'>
import '_abc' # <class '_frozen_importlib.BuiltinImporter'>
import 'abc' # <class '_frozen_importlib.FrozenImporter'>
import 'io' # <class '_frozen_importlib.FrozenImporter'>
import '_stat' # <class '_frozen_importlib.BuiltinImporter'>
import 'stat' # <class '_frozen_importlib.FrozenImporter'>
import '_collections_abc' # <class '_frozen_importlib.FrozenImporter'>
import 'genericpath' # <class '_frozen_importlib.FrozenImporter'>
import '_winapi' # <class '_frozen_importlib.BuiltinImporter'>
import 'ntpath' # <class '_frozen_importlib.FrozenImporter'>
import 'os' # <class '_frozen_importlib.FrozenImporter'>
import '_sitebuiltins' # <class '_frozen_importlib.FrozenImporter'>
Processing user site-packages
Processing global site-packages
Adding directory: 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311'
Adding directory: 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages'
Processing .pth file: 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\distutils-precedence.pth'
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\site-packages\_distutils_hack\__pycache__\__init__.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\site-packages\_distutils_hack\__init__.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\_distutils_hack\\__pycache__\\__init__.cpython-311.pyc'
import '_distutils_hack' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51CFC550>
import 'site' # <class '_frozen_importlib.FrozenImporter'>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\rlcompleter.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\rlcompleter.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\rlcompleter.cpython-311.pyc'
import 'atexit' # <class '_frozen_importlib.BuiltinImporter'>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\inspect.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\inspect.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\inspect.cpython-311.pyc'
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\ast.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\ast.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\ast.cpython-311.pyc'
import '_ast' # <class '_frozen_importlib.BuiltinImporter'>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\contextlib.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\contextlib.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\contextlib.cpython-311.pyc'
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\collections\__pycache__\__init__.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\collections\__init__.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\collections\\__pycache__\\__init__.cpython-311.pyc'
import 'itertools' # <class '_frozen_importlib.BuiltinImporter'>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\keyword.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\keyword.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\keyword.cpython-311.pyc'
import 'keyword' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51D92410>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\operator.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\operator.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\operator.cpython-311.pyc'
import '_operator' # <class '_frozen_importlib.BuiltinImporter'>
import 'operator' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51D92990>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\reprlib.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\reprlib.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\reprlib.cpython-311.pyc'
import 'reprlib' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51D935D0>
import '_collections' # <class '_frozen_importlib.BuiltinImporter'>
import 'collections' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51D66F50>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\functools.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\functools.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\functools.cpython-311.pyc'
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\types.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\types.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\types.cpython-311.pyc'
import 'types' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51DB2DD0>
import '_functools' # <class '_frozen_importlib.BuiltinImporter'>
import 'functools' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51D74DD0>
import 'contextlib' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51D26390>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\enum.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\enum.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\enum.cpython-311.pyc'
import 'enum' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51D67210>
import 'ast' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51D24B90>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\dis.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\dis.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\dis.cpython-311.pyc'
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\opcode.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\opcode.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\opcode.cpython-311.pyc'
import '_opcode' # <class '_frozen_importlib.BuiltinImporter'>
import 'opcode' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D52005350>
import 'dis' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51D26F50>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\collections\__pycache__\abc.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\collections\abc.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\collections\\__pycache__\\abc.cpython-311.pyc'
import 'collections.abc' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51FF67D0>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\importlib\__pycache__\__init__.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\importlib\\__pycache__\\__init__.cpython-311.pyc'
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\warnings.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\warnings.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\warnings.cpython-311.pyc'
import 'warnings' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D52011110>
import 'importlib' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D52011990>
import 'importlib.machinery' # <class '_frozen_importlib.FrozenImporter'>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\linecache.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\linecache.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\linecache.cpython-311.pyc'
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\tokenize.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\tokenize.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\tokenize.cpython-311.pyc'
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\re\__pycache__\__init__.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\re\__init__.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\re\\__pycache__\\__init__.cpython-311.pyc'
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\re\__pycache__\_compiler.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\re\_compiler.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\re\\__pycache__\\_compiler.cpython-311.pyc'
import '_sre' # <class '_frozen_importlib.BuiltinImporter'>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\re\__pycache__\_parser.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\re\_parser.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\re\\__pycache__\\_parser.cpython-311.pyc'
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\re\__pycache__\_constants.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\re\_constants.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\re\\__pycache__\\_constants.cpython-311.pyc'
import 're._constants' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D52039790>
import 're._parser' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D5202E7D0>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\re\__pycache__\_casefix.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\re\_casefix.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\re\\__pycache__\\_casefix.cpython-311.pyc'
import 're._casefix' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D52040FD0>
import 're._compiler' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D520270D0>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\copyreg.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\copyreg.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\copyreg.cpython-311.pyc'
import 'copyreg' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D52042190>
import 're' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D520254D0>
# C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\__pycache__\token.cpython-311.pyc matches C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\token.py
# code object from 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\__pycache__\\token.cpython-311.pyc'
import 'token' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D52026950>
import 'tokenize' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D520161D0>
import 'linecache' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D520118D0>
import 'inspect' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51CFE950>
import 'rlcompleter' # <_frozen_importlib_external.SourceFileLoader object at 0x0000021D51CE7B50>
It only does then when I do -v though. Is there anything I can do on my end, or should I just use a different version of python to get rid of this?
答案1
得分: 1
根据文档,-v
标志 启用此行为:
> 每次初始化模块时都会打印一条消息,显示加载它的位置(文件名或内置模块)。
要获取版本信息,您应该使用 python -V
(注意大小写)或 python --version
。
您还可以使用 python --help
查找可用选项的描述。
英文:
According to the documentation, the -v
flag enables this behavior:
> Print a message each time a module is initialized, showing the place (filename or built-in module) from which it is loaded.
To get the version, you should use python -V
(note the case) or python --version
.
You can also find descriptions of the available options with python --help
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论