[英]ModuleNotFoundError although package is installed
I amd getting: ModuleNotFoundError: No module named 'flask' , when trying to run a file that starts 我得到: ModuleNotFoundError:尝试运行启动的文件时没有名为'flask'的模块
from flask import Flask
来自flask进口烧瓶
~/PycharmProjects/project01/venv$ python -m flask --versionFlask 1.0.2 Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
why does my interpreter can't find the flask module (i am guessing this is not specific to flask)? 为什么我的口译员找不到烧瓶模块(我猜这不是烧瓶专用的)? tried to browse through some previous suggested solution like this: ModuleNotFoundError: No module named 'flask' but it didn't solve the problem Made sure my PyCharm project interpreter is pointing to /home/my_user/PycharmProjects/project01/venv/bin/python and not another interpreter The only way i could have solved it is by installing the flask through the PyCharm Gui, but i really would like to understand why installing from the terminal with
pip install flask
didn't work 尝试浏览一些以前建议的解决方案,如下所示: ModuleNotFoundError:没有名为'flask'的模块,但它没有解决问题确保我的PyCharm项目解释器指向/ home / my_user / PycharmProjects / project01 / venv / bin / python而不是另一个解释器我能解决它的唯一方法是通过PyCharm Gui安装烧瓶,但我真的很想知道为什么从带有
pip install flask
的终端pip install flask
不起作用
source venv/bin/activate
And install flask
on the venv; 并在venv上安装
flask
; after run the script using the venv python binary. 在使用venv python二进制文件运行脚本之后。 - I believe you either have not installed
flask
in the virtual environment or you're not using the virtual environment python. - 我相信你要么没有在虚拟环境中安装
flask
,要么你没有使用虚拟环境python。
To check which python binary you're invoking: 要检查您正在调用哪个python二进制文件:
whereis python
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.