尝试在 WSL 2 上为 pgAdmin4 配置 Python 环境时出错 [已关闭]

问题描述 投票:0回答:1

我正在尝试从 WSL 2(运行 Ubuntu 22.04 (Jammy Jellyfish) 发行版)上的源代码安装 pgAdmin4,并且我一直在按照

pgAdmin4 的 GitHub 存储库中的 
README 文档中的步骤操作 .

为了配置 Python 环境,我已成功完成步骤 1 到 5。现在,我尝试使用以下命令运行数据库配置的初始设置:

(venv) hallixon@PC:~/pgadmin4$ sudo python3 web/setup.py

(venv) hallixon@PC:~/pgadmin4$ sudo python3 web/pgAdmin4.py

但这两个命令都会引发以下错误:

Traceback (most recent call last):
  File "/home/hallixon/pgadmin4/web/pgAdmin4.py", line 49, in <module>
    import config
  File "/home/hallixon/pgadmin4/web/config.py", line 32, in <module>
    from pgadmin.utils import env, IS_WIN, fs_short_path
  File "/home/hallixon/pgadmin4/web/pgadmin/__init__.py", line 24, in <module>
    from flask import Flask, abort, request, current_app, session, url_for
ModuleNotFoundError: No module named 'flask'

同时,运行以下脚本以显示当前虚拟环境(venv)中安装的模块列表,并在列表中返回

flask

>>> help('modules')

请问我该如何解决这个问题?我还希望获得展示如何在 WSL 2(最好是 Ubuntu 发行版)上从源代码安装 pgAdmin4 的文章链接。

python postgresql pgadmin-4 apache-age
1个回答
-1
投票

您应该尝试在没有

sudo
的情况下运行脚本。使用
sudo
,Python 解释器可能无法找到虚拟环境中安装的包。

© www.soinside.com 2019 - 2024. All rights reserved.