Hope this question is not already answered, I've searched many posts but none of them says how to change an environment variable.
I wanted to load environment variables in .env
so followed the steps in this post.
%env "OPENAI_API_KEY"=OPENAI_API_KEY
Then I wanted to see my variable with:
%env OPENAI_API_KEY
Everything worked well but my mistake was to erroneously copy the value for my environment variable. So I want to change it.
I tried dotenv to load this variable again but seems not to work.
Hope you can help me, please.
I tried doing again the same procedure so that it can be changed/updated.
If you made a mistake writing your APIKEY:
Created a .env
with your credentials:
OPENAI_API_KEY="...erroneous-api-key..."
You verified:
%env OPENAI_API_KEY
And you realized it is wrong.
You can:
import os
del os.environ["OPENAI_API_KEY"]
Then:
os.environ["OPENAI_API_KEY"]="...right-key..."
To verify this:
%env OPENAI_API_KEY
And the updated api-key should be prompted.