由于某些模块似乎无法识别,从apache2启动时,我正在使用的python3 CLI脚本无法完全运行吗?当用PHP调用它时,它似乎可以完全正常工作,但是某些模块导致它失败...
例如,我必须将plotly.XXXX注释掉,或者说找不到模块,Apache日志:
File "/var/www/pythonhack_site/test.py",line 16,in <module>
import plotly.figure_factory as ff
ImportError: No module named 'plotly.figure_factory'
示例代码:
#!/usr/bin/python3
import requests,enchant,urllib.request,socket
import argparse,os,ssl,re,sys,time
from bs4 import BeautifulSoup
from urllib.parse import urlparse
# from plotly.subplots import make_subplots
import plotly.figure_factory as ff
# import plotly.graph_objects as go
# import plotly
# import numpy as np
此外,我还必须删除使用附魔Dict()的代码:
#d = enchant.Dict("en_US")
因为它在apache日志中抱怨:
File "/var/www/pythonhack_site/test.py",line 259,in get_general_word_counts
d = enchant.Dict("en_US")
AttributeError: module 'enchant' has no attribute 'Dict'