ModuleNotFoundError:泊坞窗中没有命名模块

时间:2019-08-05 22:05:36

标签: python python-3.x docker flask

当我发布docker-compose up时,我遇到了flask-simpleldap的modulenotfound。当我在环境路径中键入以下内容时,我看到它已安装。

iSOC=18
tSOC=42
step1=6
df=pd.DataFrame(iSOC)
df.insert(iSOC-step1,iSOC,iSOC+step1)

我已经删除了python2.7的所有痕迹,并使用pip3和python3资源重建了我的docker实例,但是仍然存在此问题。

(env) root@pdc-mgmt-netauto:/home/administrator/app/flask# pip install flask-simpleldap
Requirement already satisfied: flask-simpleldap in ./env/lib/python3.6/site-packages (1.4.0)
Requirement already satisfied: python-ldap>=3.0.0 in ./env/lib/python3.6/site-packages (from flask-simpleldap) (3.2.0)
Requirement already satisfied: Flask>=0.12.4 in ./env/lib/python3.6/site-packages (from flask-simpleldap) (1.1.1)
Requirement already satisfied: pyasn1>=0.3.7 in ./env/lib/python3.6/site-packages (from python-ldap>=3.0.0->flask-simpleldap) (0.4.6)

Docker文件:

flask    | *** Operational MODE: preforking+threaded ***
flask    | Traceback (most recent call last):
flask    |   File "run.py", line 1, in <module>
flask    |     from app import app
flask    |   File "./app/__init__.py", line 5, in <module>
flask    |     from app import views
flask    |   File "./app/views.py", line 2, in <module>
flask    |     from flask_simpleldap import LDAP
flask    | ModuleNotFoundError: No module named 'flask_simpleldap'
flask    | unable to load app 0 (mountpoint='') (callable not found or import error)
flask    | *** no app loaded. going in full dynamic mode ***
flask    | uWSGI running as root, you can use --uid/--gid/--chroot options
flask    | *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
flask    | *** uWSGI is running in multiple interpreter mode ***

安装的flask_simpleldap的路径

在环境中找到

# Use the Python3.7.2 image
FROM python:3.6

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app 
ADD . /app

# Install the dependencies
RUN pip3 install -r requirements.txt

# run the command to start uWSGI
CMD ["uwsgi", "app.ini"]

0 个答案:

没有答案