I've installed openai on my laptop with pip install openai
.
Have installed on my laptop and after installed on the same folder where my code file is. But when I try to run the code I get ImportError: No module named openai
This is the code from the file. Pretty simple:
import openai
openai.api_key = API_KEY
prompt = "Say this is a test"
response = openai.Completion.create(
engine="text-davinci-001", prompt=prompt, max_tokens=6
)
print(response)
What am I doing wrong?
which python
orwhere python
on widows to see if it is the same install of python you are using to run your code. – Sophy/usr/bin/python
.Appreciate your help – Multistage/Escritorio/coding/python$
– Multistageconda
make sure to usepip3
andpython3
– SophyImportError: No module named openai
.I can't figure out what is wrong – MultistagePython 3.9.12 64-bit
,Python 3.6.9 64-bit
andPython 2.7.17 64-bit
with thePython 3. it doesn't flag openai on file but with Python2 it flags it. Anyway trying all different ways I still getImportError: No module named openai
– Multistageopenai
but not when Iimport openai
in idle. – Mcgean