当激活conda虚拟环境时,我已经使用pip安装了我的软件包(让我们只需要调用它" mypackage")。我可以确认它是使用pip list安装的。但是,当我尝试运行' flask run'时,我收到一条错误消息" ImportError:没有名为' mypackage'"的模块。当我看回溯时,虽然我确实激活了我的conda env,但是烧瓶cli与我的conda env并不对应。追溯似乎说烧瓶正在根环境中运行。
Traceback (most recent call last):
File "/home/borg/anaconda3/bin/flask", line 6, in <module>
sys.exit(flask.cli.main())
File "/home/borg/anaconda3/lib/python3.5/site-packages/flask/cli.py", line 478, in main
cli.main(args=args, prog_name=name)
File "/home/borg/anaconda3/lib/python3.5/site-packages/flask/cli.py", line 345, in main
return AppGroup.main(self, *args, **kwargs)
File "/home/borg/anaconda3/lib/python3.5/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/home/borg/anaconda3/lib/python3.5/site-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/borg/anaconda3/lib/python3.5/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/borg/anaconda3/lib/python3.5/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/home/borg/anaconda3/lib/python3.5/site-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/home/borg/anaconda3/lib/python3.5/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/home/borg/anaconda3/lib/python3.5/site-packages/flask/cli.py", line 388, in run_command
app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
File "/home/borg/anaconda3/lib/python3.5/site-packages/flask/cli.py", line 124, in __init__
self._load_unlocked()
File "/home/borg/anaconda3/lib/python3.5/site-packages/flask/cli.py", line 148, in _load_unlocked
self._app = rv = self.loader()
File "/home/borg/anaconda3/lib/python3.5/site-packages/flask/cli.py", line 209, in load_app
rv = locate_app(self.app_import_path)
File "/home/borg/anaconda3/lib/python3.5/site-packages/flask/cli.py", line 89, in locate_app
__import__(module)