Python 2 + Flask - ImportError: No module named request -
i'm trying install flask, using pip.
running basic:
from flask import flask app = flask(__name__) @app.route("/") def hello(): return "hello world!" if __name__ == "__main__": app.run()
i importerror: no module named request
python --version
returns python 2.7.6
pip show flask
returns version: 0.10.1
from i've been able find, request
module python 3 related. , says use urllib2
.
so i've added import urllib2
, get:
importerror: dlopen(/usr/local/cellar/python/2.7.10_2/frameworks/python.framework/versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): symbol not found: __pyerr_replaceexception referenced from: /usr/local/cellar/python/2.7.10_2/frameworks/python.framework/versions/2.7/lib/python2.7/lib-dynload/_io.so expected in: flat namespace
what doing wrong?
creating virtualenv worked me. following steps on page http://flask.pocoo.org/docs/0.10/installation/#virtualenv do:
pip install virtualenv virtualenv my_name . my_name/bin/activate pip install flask python index.py
to make basic flask app running inside my_name virtualenv.
Comments
Post a Comment