8

In fact I cannot use any pakage now!

importerror: no module named flask.ext.script

importerror: no module named Pymongo

Mark White
  • 640
  • 1
  • 5
  • 12

4 Answers4

7

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

lord63. j
  • 4,500
  • 2
  • 22
  • 30
  • I have used it by both the import statements i.e 'from flask.ext.script import Manager' and 'from flask_script import Manager' with latest flask-script 2.0.5 both of them don't throw any exception, but get error while running cronjob – user956424 Aug 03 '16 at 08:14
1

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

Randolph Kevin
  • 157
  • 1
  • 3
0

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 ...

Hamed Baziyad
  • 1,954
  • 5
  • 27
  • 40
0

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

Randika
  • 11
  • 4