PyOWM installed but not recognized?

Viewed 251

Disclaimer - I am quite new to Python.

I wanted to use the OWM API to make a simple Python weather program. I found some guides to using this key on the web, and they said to use the PyOWM library. I DuckDuckGoed how to install it and I downloaded Pip. I put it in C:/pip and tried to run 'python get-pip.py' (yes, I was in the directory in CMD).

It didn't work, and it sent me to the Microsoft Store page for Python. I installed it (even though i had the normal ver installed) and tried again. Pip installed.

I ran pip install pyowm and it installed. Everything seemed fine. When I went back into PyCharm, it wouldn't work. This is the code from the tutorial I am watching:

import pyowm
owm = pyowm.OWM('<api_key>') # TODO: Replace <api_key> with your API key
la = owm.three_hours_forecast('Los Angeles, US')
print(la.will_have_clouds())

Any ideas?

1 Answers

In Pycharm, you have to install your library in the project interpreter.

In your Pycharm go to File -> settings -> Project:test(In my case test means my project name) -> select project interpreter -> click add button

enter image description here

After clicking add button and search pyowm then install it.

Related