这是由于代码文件中有中文文字,无法解码导致:
Fatal Python error: Py_Initialize: Unable to get the locale encoding
Traceback (most recent call last):
File "<frozen importlib._bootstrap_external>", line 1096, in _path_importer_cache
KeyError: '/opt/tmp/tmp/spark-3e3a5ada-b265-4f81-8bbf-b46fc4bf5668/py_dev.zip'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 951, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 894, in _find_spec
File "<frozen importlib._bootstrap_external>", line 1157, in find_spec
File "<frozen importlib._bootstrap_external>", line 1126, in _get_spec
File "<frozen importlib._bootstrap_external>", line 1098, in _path_importer_cache
File "<frozen importlib._bootstrap_external>", line 1074, in _path_hooks
NotImplementedError: bootstrap issue: python36.zip contains non-ASCII filenames without the unicode flag
解决方法:
在每个py文件第一行中加入:
# -*- coding: utf-8 -*-
即可解决