添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
性感的伤疤  ·  使用CSS ...·  1 年前    · 
逼格高的伤痕  ·  c# - Hot to set R ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams
Traceback (most recent call last):
File "app.py", line 1, in <module>
from flask import Flask
ImportError: No module named Flask

I do have flask installed. I was thinking it's a $PATH issue. I don't really know where to begin as far as troubleshooting goes.

which flask gives me: /usr/local/bin/flask

which python gives me: /usr/bin/python

Any help is much appreciated, there are other similar issues out there but those solutions have not helped. Happy to answer any questions. Thank you.

Answers to questions:

Q. Which Python version? A. Python 2.7.10

Q. How did you install Flask? A. pip install flask

If pip installation didn't fail, all paths should be correct. You could check $PYTHONPATH. @dim has a good point. Do you have a folder named flask or a file you named flask.py in the same directory? – CAB Oct 12, 2016 at 3:12

It looks like that you are using linux, if you are using ubuntu try: (similar for other linux distributions)

sudo apt-get install python-flask

It helped me install many packages that pip fails to install.

You can try to uninstall and to reinstall it again(you can follow this link for more detaile) :

http://flask.pocoo.org/docs/0.12/installation/#installation

You can take anaconda and there you can make enviroment for every version of python .Anaconda is getting very easy from this link: https://docs.anaconda.com/anaconda/install/

Then you can open terminal and pip install flask (if you are on windows) or conda pip install flask .

I recommand to use python3.5 not python 2.7 .

pip3 install flask

and if you fail (you are likely to get an command prompt error as below)

'pip3' is not recognized as an internal or external command, operable program or batch file.

py -3 -mpip install flask on windows

this command installs flask module on python 3, and then you could run your script. worked for me!

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.