在 python 中使用带有烧瓶的预装库或包 [英] Using pre-installed library or packages with flask in python

查看:26
本文介绍了在 python 中使用带有烧瓶的预装库或包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了开发所需的所有库.但是当我尝试在 Flask 虚拟环境中导入它们时,它说找不到模块".当我尝试在没有虚拟环境的命令提示符下运行 python 时,它会导入它们而没有任何错误.所以我得出的结论是虚拟环境需要重新安装所有库.我不想这样做,还有其他办法吗?

I already have all the libraries required for development installed. But when I try to import them in flask virtual environment, it says "Module not found". When I try to run python in command prompt without a virtual environment, it does import them without any error. So I have reached the conclusion that virtual environment needs all libraries installed again. I don't want to do that is there any other way?

推荐答案

如果您使用 --system-site-packages 标志,你可以使用全局安装的包.默认情况下,您不能.

If you create your virtualenv with the --system-site-packages flag, you can make use of globally installed packages. By default, you cannot.

这篇关于在 python 中使用带有烧瓶的预装库或包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆