【发布时间】:2023-03-07 08:33:02
【问题描述】:
我无法找出 Apache 中的 mod_wsgi 正在使用哪个 python 环境或安装位置。在我的 apache 配置中,我没有提供任何特定的 venv 配置。
ServerName
ServerAlias
DocumentRoot /home/Downloads
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /static /home/Downloads/static
<Directory /home/Downloads/static>
Require all granted
</Directory>
<Directory /home/Downloads/samples>
Require all granted
</Directory>
<Directory /home/Downloads>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
#WSGIDaemonProcess group python-path=/home/Downloads python-home=/home/envlin
WSGIProcessGroup group
WSGIScriptAlias / /home/Downloads/wsgi.py
我删除了关键信息并替换为随机信息。
这是我的 apache 重启日志
Apache 日志
Apache/2.4.46 (Ubuntu) OpenSSL/1.1.1j mod_wsgi/4.7.1 Python/3.9 configured -- resuming normal operations
问题
有什么方法可以获取 mod_wsgi 正在使用哪个 python 版本和安装位置。
**Python 路径的** 如果我获取 python 路径通常是这里的结果。
sys.path = [
'/root',
'/usr/lib/python39.zip',
'/usr/lib/python3.9',
'/usr/lib/python3.9/lib-dynload',
'/usr/local/lib/python3.9/dist-packages',
'/usr/lib/python3/dist-packages',
'/usr/lib/python3.9/dist-packages',
]
【问题讨论】:
-
您实际上发布了该信息,不是吗?
-
但是在这些 dist-packages 中,我找不到我从 requirements.txt 安装的 pip 安装包。只是想确认一下我是否可以得到正在使用的python mod_wsgi或python版本的路径。
-
你是如何安装这些包的? virtualenv 是否处于活动状态?
-
pip install -r requirements.txt
标签: python django apache web mod-wsgi