Python 2.7.9: No module named requests -
i writing code in python 2.7.9 need requests module. installed module using sudo pip install requests still in python 2.7.9 getting error follows:
python 2.7.9 (default, jan 5 2016, 18:47:14) [gcc 4.8.4] on linux2 type "help", "copyright", "credits" or "license" more information. >>> import requests traceback (most recent call last): file "<stdin>", line 1, in <module> importerror: no module named requests i checked installation location /usr/local/lib/python2.7/dist-packages, contains requests package directory. same thing works fine in python3, guessing it's installation error. how can fix ?
edit:
on executing pip lists, see requests (2.1.9) in list. after ran pip uninstall requests shows requests (2.2.1) in pip list.
based on comments, seems have installed python 2.7.9 using method ubuntu doesn't like. because of dist-packages folder not added sys.path. set pythonpath variable in .bashrc (or other zshrc, etc) add folder sys.path default.
better method use library pyenv (it handles dependency issues flawlessly multiple python versions) or better supported ppa latest python problem shouldn't arise @ all.
also, have 2 versions of requests. seems because 1 installed using apt-get (sudo apt-get install python-requests) , other pip (sudo pip install requests). remove 1 of them avoid confusion.
Comments
Post a Comment