Numba environment variable not set through .numba_config.yaml [duplicate]

倾然丶 夕夏残阳落幕 提交于 2019-12-25 03:37:36

问题


Some environment variables can be set for numba, as specified in the doc: https://numba.pydata.org/numba-doc/dev/reference/envvars.html

However, launching a python shell in the same folder, I cannot see the variable in os.environ:

In [1]: !cat .numba_config.yaml                                                                      
warnings: 1

In [2]: import os; os.environ["NUMBA_WARNINGS"]                                                      
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-2-2d63c69434b7> in <module>
----> 1 import os; os.environ["NUMBA_WARNINGS"]

~/anaconda3/lib/python3.6/os.py in __getitem__(self, key)
    667         except KeyError:
    668             # raise KeyError with the original key value
--> 669             raise KeyError(key) from None
    670         return self.decodevalue(value)
    671 

KeyError: 'NUMBA_WARNINGS'

(I have pyyaml installed, import yaml does not yield an error)


回答1:


You can get and set environment variables via os.environ



来源:https://stackoverflow.com/questions/54035751/numba-environment-variable-not-set-through-numba-config-yaml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!