Mark White
Mark White

Reputation: 660

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

Upvotes: 8

Views: 11319

Answers (4)

Randika
Randika

Reputation: 11

from flask.ext.extension import xxx is the old way of importing extensions ,now it's not working .You have to freeze first to outputs the package and its version installed in the current environment . Then you can check your module and import it as usual

e.g: -from flask_bcrypt import Bcrypt #this import the Bcrypt from flask_bcrypt

Upvotes: 0

Mohamed Abdelmagid
Mohamed Abdelmagid

Reputation: 31

I think you should use python 2 to use this module flask.ext.script" because this is the old way of doing it, or you could install Flask-Script and import it this way from flask_script import ...

Upvotes: 0

Randolph Kevin
Randolph Kevin

Reputation: 157

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

Upvotes: 1

lord63. j
lord63. j

Reputation: 4670

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

Upvotes: 8

Related Questions