1

I am trying to set up some sample code with flask+python on my machine, I am following the website as below

http://blog.miguelgrinberg.com/post/flask-pagedown-markdown-editor-extension-for-flask-wtf

However I have a problem as below.

from flask.ext.pagedown import PageDown


Traceback (most recent call last):
  File "/Users/iMacBin/Documents/projects/flask/flasky/manage.py", line 3, in <module>
    from app import create_app, db
  File "/Users/iMacBin/Documents/projects/flask/flasky/app/__init__.py", line 7, in <module>
    from flask.ext.pagedown import PageDown
  File "/Library/Python/2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/exthook.py", line 87, in load_module
    raise ImportError('No module named %s' % fullname)
ImportError: No module named flask.ext.pagedown

I did install flask-pagedown, markdown and bleach using pip on my machine.

(venv) $ pip install flask-pagedown markdown bleach

I did search online and noticed that flask.ext might be stale, so I also tried

from flask_pagedown import PageDown

but it has the same issue, 'No module named flask_pagedown'

FYI, my python version is 2.7.6. The IDE I am using is PyCharm.

Could anybody advise anything else I can check?

4

1 回答 1

1

我不能告诉你问题是什么,但它至少对我有用..

(env)➜ ocmg-py-frontend git:(master) ✗ pip install flask-pagedown
Collecting flask-pagedown
  Downloading https://devpi.ocx.dk/root/pypi/+f/73a/4fb383fcd4e1f/Flask-PageDown-0.1.5.tar.gz
Requirement already satisfied (use --upgrade to upgrade): Flask in ./env/lib/python2.7/site-packages (from flask-pagedown)
Collecting WTForms (from flask-pagedown)
  Downloading https://devpi.ocx.dk/root/pypi/+f/364/4164ce003ef52/WTForms-2.0.2-py27-none-any.whl (128kB)
    100% |################################| 131kB 2.0MB/s
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in ./env/lib/python2.7/site-packages (from Flask->flask-pagedown)
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in ./env/lib/python2.7/site-packages (from Flask->flask-pagedown)
Requirement already satisfied (use --upgrade to upgrade): itsdangerous>=0.21 in ./env/lib/python2.7/site-packages (from Flask->flask-pagedown)
Requirement already satisfied (use --upgrade to upgrade): markupsafe in ./env/lib/python2.7/site-packages (from Jinja2>=2.4->Flask->flask-pagedown)
Installing collected packages: WTForms, flask-pagedown

  Running setup.py install for flask-pagedown
Successfully installed WTForms-2.0.2 flask-pagedown-0.1.5
(env)➜ ocmg-py-frontend git:(master) ✗ python
Python 2.7.9 (default, Jan  7 2015, 11:49:12)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from flask.ext.pagedown import PageDown
>>>
于 2015-03-21T02:32:44.420 回答