简体   繁体   English

在 Apache 中的 mod_wsgi 中运行 Python 看不到 /usr/local/lib64/python3.6/site-packages 中的 Python 模块

[英]Running Python in mod_wsgi in Apache Cannot See Python Modules in /usr/local/lib64/python3.6/site-packages

I have had scores of servers running a Python script via Apache and mod_wsgi for years now.多年来,我有很多服务器通过 Apache 和 mod_wsgi 运行 Python 脚本。 I recently am building on RHEL7 and have run into an issue where my Python script calling R procedures are bombing out only via Apache stating it cannot find my pip installed Python modules in my Apache log. I recently am building on RHEL7 and have run into an issue where my Python script calling R procedures are bombing out only via Apache stating it cannot find my pip installed Python modules in my Apache log.

import pandas as pd ModuleNotFoundError: No module named 'pandas'将 pandas 导入为 pd ModuleNotFoundError:没有名为“pandas”的模块

This seems to only affect modules getting installed in /usr/local/lib64/python3.6/site-packages which is where my custom modules are being installed with pip.这似乎只影响安装在 /usr/local/lib64/python3.6/site-packages 中的模块,这是我的自定义模块与 pip 一起安装的位置。

Even if I append it, it ignores it.即使我 append 它,它也会忽略它。

sys.path.append(r'/usr/local/lib64/python3.6/site-packages') sys.path.append(r'/usr/local/lib64/python3.6/site-packages')

I manually built mod_wsgi from source.我从源代码手动构建了 mod_wsgi。

I'm ready to abandon mod_wsgi because I have to get my application deployed for my users.我准备放弃 mod_wsgi 因为我必须为我的用户部署我的应用程序。

Any help is greatly appreciated.任何帮助是极大的赞赏。

Thanks,谢谢,

Lou

It was a file priv issue with /usr/lib64/python3.6 and /usr/lib/python3.6 directories and their child directories.这是 /usr/lib64/python3.6 和 /usr/lib/python3.6 目录及其子目录的文件权限问题。 Root ran fine, but running as Apache had no access. Root 运行良好,但以 Apache 的身份运行无法访问。 You had to chmod-R 755 on both directory trees.您必须在两个目录树上 chmod-R 755。 Worked fine with Apache after that.之后与 Apache 一起工作正常。 Sometimes it's the simple things we forget to check first.有时这是我们忘记先检查的简单事情。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 mod_wsgi错误:ImportError:dlopen(/usr/local/lib/python3.6/site-packages/cv2.so,2):找不到符号:_iconv - mod_wsgi Error: ImportError: dlopen(/usr/local/lib/python3.6/site-packages/cv2.so, 2): Symbol not found: _iconv Django如何在此文件夹“ /usr/local/lib/python3.6/site-packages”下找到Bootstrap文件? - How did Django find Bootstrap files under this folder “/usr/local/lib/python3.6/site-packages”? 我不小心删除了我的/usr/lib/python3.6/site-packages/* - I accidentally remove my /usr/lib/python3.6/site-packages/* pip 安装在 usr/lib/python3.6/site-packages 而不是 ubuntu 服务器上的 virtualenv - pip installing in usr/lib/python3.6/site-packages instead of virtualenv on ubuntu server 使用张量流时出现ImportError:dlopen(/usr/local/lib/python3.6/site-packages/cv2/cv2.cpython-36m-darwin.so,2) - getting ImportError: dlopen(/usr/local/lib/python3.6/site-packages/cv2/cv2.cpython-36m-darwin.so, 2) when working with tensor flow 使用 webargs 时,flassger 在 lib/python3.6/site-packages/webargs 中寻找模板 - While using webargs flassger is looking for templates in lib/python3.6/site-packages/webargs NameError:名称'hasattr'未定义 - Python3.6,Django1.11,Ubuntu16-17,Apache2.4,mod_wsgi - NameError: name 'hasattr' is not defined - Python3.6, Django1.11, Ubuntu16-17, Apache2.4, mod_wsgi ImportError:dlopen(/usr/local/lib/python2.7/site-packages/_geoslib.so - ImportError: dlopen(/usr/local/lib/python2.7/site-packages/_geoslib.so 如何在Linux下的/usr/local/lib/python2.7/site-packages下安装Pip - how to Install Pip under /usr/local/lib/python2.7/site-packages in Linux python 3.6安装和lib64 - python 3.6 installation and lib64
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM