ich bin aktuell echt am verzweifeln.
Ich nutze Python 3.8 auf Windows 10 (PATH aktiviert).
Ich möchte "requests" installieren, was - scheinbar auch funktioniert hat.
Windows Command Prompt: -python -m pip install request
>>>Collecting requests
(...)
>>>Successfully installed certifi-2020.4.5.1 chardet-3.0.4 idna-2.9 requests-2.23.0 urllib3-1.25.9
Anschließend habe ich PyCharme geöffnet, eine neue .py-Datei angelegt und folgenden Code eingefügt:
Code: Alles auswählen
# Make a get request to get the latest position of the international space station from the opennotify api.
response = requests.get("http://api.open-notify.org/iss-now.json")
# Print the status code of the response.
print(response.status_code)
Code: Alles auswählen
Traceback (most recent call last):
File "C:/Users/Pierre/PycharmProjects/APITest/sdfsf.py", line 2, in <module>
response = requests.get("http://api.open-notify.org/iss-now.json")
NameError: name 'requests' is not defined
Code: Alles auswählen
import requests
Code: Alles auswählen
Traceback (most recent call last):
File "C:/Users/Pierre/PycharmProjects/APITest/sdfsf.py", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Wenn ich "import requests" im Python 3.8 Shell ausführe, bekomme ich keine Fehlermeldung. Hat das irgendwas damit zu tun, dass mein PyCharme falsch konfiguriert ist?
Danke für eure Hilfe!
gurke