microsoft / c9-python-getting-started

Sample code for Channel 9 Python for Beginners course
MIT License
7.75k stars 2.25k forks source link

No module named"requests" on chapter 37 #22

Closed SharkTal closed 4 years ago

SharkTal commented 4 years ago

After I copied the code to my VS and added subscription key, I execute the code, however, it showed the mistake. Traceback (most recent call last): File "c:/Autumn_Courses_2019/Python/API/API_json.py", line 6, in import requests ModuleNotFoundError: No module named 'requests'

Why it triggered and how to solve it ? Thanks

pranav1698 commented 4 years ago

This issue is more of a local problem, you are not able to run the python file because you have not installed requests module in your local machine. That triggers the issue, I will open another issue that will solve any other similar issues

pranav1698 commented 4 years ago

This can be solved by adding requirements.txt file in the Packages folder We can additionally add documentation in the readme file in Packages folder on how to use use this file

0x4d-github commented 4 years ago

One of the problems could be that in VS the python interpreter is still selected from the previous exercise (virtual environment). check in the lower right corner if you get something like Python 3.7.....-bit('venv':venv). You should change it so that it is not calling virtual environment anymore.