标签: python
如何创建环境变量以将我的秘密信息保存在虚拟环境中。我在标准库中使用 venv 模块。谁能给我步骤? 我尝试编辑 bash_profile 文件并添加一个变量,但它在 venv 中无法访问!
答案 0 :(得分:1)
$HOME/.bash_profile 未包含在 venv 的 activate 脚本中。您必须将 export SECRETVAR="secretvalue" 添加到 activate 脚本的末尾。
$HOME/.bash_profile
activate
export SECRETVAR="secretvalue"