I am trying to import urllib.request for python 2.7.10 on PyCharm 4.5.4 on Window 10 but getting the error "ImportError: No module named request".
6 Answers
It may happen sometimes, usually in the Linux environment. You have both 2.x and 3.x versions of python installed.
So, in that case, if you are using the command python "file.py"
then by default, it will python 2.x will run the file.
So, use the command python3 "file.py"
I was facing this issue. Maybe it can resolve someone's issue.
Use > Path\easy_install.exe requests if you have a windows machine, where easy_install can be found in your Python*\Scripts folder, if it was installed. (Note Path\easy_install.exe is an example, mine is C:\Python32\Scripts\easy_install.exe)
If you don't have easy install and are running on a windows machine, you can get it here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#distribute
If you manually want to add a library to a windows machine, you can download the compressed library, uncompress it, and then place it into the Lib folder of your python path.
OR
You need to install pip first and then install django-request using pip
pip install django-request
also install,
python setup.py install
then import
from urllib.request import urlopen
Helpful Tips:to chech this