I’m having trouble with importing the openai package in my Python script. I used pip install openai to install it on my computer and even tried installing it again in the same directory as my Python file.
Whenever I try to execute my script, I keep getting this error: ImportError: No module named openai
Here’s my basic test code:
import openai
openai.api_key = MY_SECRET_KEY
user_prompt = "Tell me this works"
api_response = openai.Completion.create(
model="text-davinci-002",
prompt=user_prompt,
max_tokens=10
)
print(api_response)
I’m not sure what I’m missing here. The installation seemed to work fine but Python can’t find the module. Any ideas what could be causing this issue?