简体   繁体   English

烧瓶导入错误和Anaconda

[英]Flask import error and Anaconda

I am having trouble running a Flask script. 我在运行Flask脚本时遇到问题。 I get the following error: 我收到以下错误:

Traceback (most recent call last):
  File "sample.py", line 17, in <module>
    from flask import Flask, make_response, render_template, request
ImportError: No module named flask

The thing is I am under Windows currently and flask is installed with pip install Flask . 事情是我目前在Windows下,并且flask是通过pip install Flask I am assuming the ImportError: No module named flask it's because the module is installed in the C:\\User\\Anaconda\\Lib\\site-packages directory and thus cannot be found by the Python interpreter: 我假设ImportError: No module named flask的模块,因为该模块安装在C:\\User\\Anaconda\\Lib\\site-packages目录中,因此Python解释器找不到该模块:

Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win 32

Any suggestions on how to resolve the issue? 有关如何解决此问题的任何建议?

尝试使用conda安装flask: conda install flask

Do you have multiple versions of Python installed? 您是否安装了多个版本的Python?

Commonly there's a system Python, then a local Python -- if a module is installed in #1, it won't be visible in #2. 通常有一个系统Python,然后是一个本地Python-如果在#1中安装了模块,则在#2中将不可见。

Consider using virtualenvwrapper -- it helps with custom Pythons and modules. 考虑使用virtualenvwrapper它有助于自定义Python和模块。 http://blog.fruiapps.com/2012/06/An-introductory-tutorial-to-python-virtualenv-and-virtualenvwrapper http://blog.fruiapps.com/2012/06/An-introductory-tutorial-to-python-virtualenv-and-virtualenvwrapper

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM