Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

importerror: no module named flask.ext.script

In fact I cannot use any pakage now!

importerror: no module named flask.ext.script

importerror: no module named Pymongo

like image 957
Mark White Avatar asked Nov 12 '15 15:11

Mark White


2 Answers

It seems that you virtual environment doesn't work. You've installed the flask-script package, but when you run the script, it still looks for it in C:\Python3.4. You may give us more info so that we can figure it out where is wrong. (How do you install it, how do you active the virtualenv, does reinstall virtualenv work, close the cmd shell and try again works?)

Also note that from flask.ext.extension import xxx is the old way to use the flask extension. Instead you should use from flask_script import Manager, Server if you are using the latest flask-script 2.0.5

like image 144
lord63. j Avatar answered Sep 23 '22 19:09

lord63. j


If you are using the IDE such as pycharm, then maybe need to set the interpreter of python for the right version. Otherwise the packages that you have installed can not be used for the current project. I have also encountered such kind of questions until I set my IDE's interpreter to the Python 2.7. Then you can freely import the flask_script

like image 36
Randolph Kevin Avatar answered Sep 25 '22 19:09

Randolph Kevin