当在调试模式下运行脚本时,我立即得到一个键为b'VIRTUAL_ENV '的KeyError。我在AWS ec2远程机器上运行。(即使在尝试运行以下代码时也会发生这种情况:(一个月一个月)
Exception has occurred: KeyError
'VIRTUAL_ENV'
File "/usr/lib/python3.6/os.py", line 666, in __getitem__
value = self._data[self.encodekey(key)]
During handling of the above exception, another exception occurred:
File "/usr/lib/python3.6/os.py", line 669, in __getitem__
raise KeyError(key) from None
File "/usr/lib/python3.6/_collections_abc.py", line 666, in __contains__
self[key]
File "/usr/lib/python3.6/site.py", line 313, in getsitepackages
if 'VIRTUAL_ENV' in os.environ or sys.base_prefix != sys.prefix:
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)```
1条答案
按热度按时间oymdgrw71#
请确保在“调试视图”中的“断点”下取消选中“引发的异常”。