"No module named 'urlparse'"但我没有使用urlparse
"No module named 'urlparse'"但我没有使用urlparse
我正在努力弄清楚为什么我看到一个错误:
ModuleNotFoundError: 找不到模块 'urlparse'
但是我在我的代码中从来没有调用过 urlparse。
当我尝试用 pip 安装 urlparse
时,我看到这个模块不存在。当我尝试用 pip 安装 urllib.parse
时,我看到同样的消息:
找不到与 urllib.parse 匹配的分发
我在这里漏掉了什么吗?
from flask import Flask, request, redirect, url_for, session, g, flash, \ render_template from flask_oauth import OAuth from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy.ext.declarative import declarative_base # configuration SECRET_KEY = 'development key' DEBUG = True # setup flask app = Flask(__name__) app.debug = DEBUG app.secret_key = SECRET_KEY oauth = OAuth() # Use Twitter as example remote app twitter = oauth.remote_app('twitter', base_url='https://api.twitter.com/1/', request_token_url='https://api.twitter.com/oauth/request_token', access_token_url='https://api.twitter.com/oauth/access_token', authorize_url='https://api.twitter.com/oauth/authenticate', consumer_key='', consumer_secret='' ) @twitter.tokengetter def get_twitter_token(token=None): return session.get('twitter_token') @app.route('/') def index(): access_token = session.get('access_token') if access_token is None: return redirect(url_for('login')) access_token = access_token[0] return render_template('templates/index.html')
if __name__ == '__main__': app.run()