我试图让profanity_check在EC2 Linux实例上运行。
问题是,当我尝试使用ImportError: No module named profanity_check运行profanity.py时,会得到一个python34 profanity.py错误。
此外,当尝试运行python profanity.py时,我会得到一个ValueError: unsupported pickle protocol: 3错误。
我认为这是因为profanity_check只适用于Python3。
此外,当我安装亵渎检查时,我收到了一个DEPRECATION: Python 2.7 will reach the end of its life警告。但是,我已经在系统上安装了Python3.4.9。
根据这个问题,here,我已经检查了__init__.py文件。它的存在看起来很稳定。
__init__.py文件的路径如下:
/home/ec2-user/.local/lib/python2.7/site-packages/profanity_check/init.py
这里有什么问题吗?
profanity.py
#!/usr/bin/python34
from profanity_check import predict, predict_prob
predict(['predict() takes an array and returns a 1 for each string if it is offensive, else 0.'])
# [0]__init__.py
from .profanity_check import predict, predict_prob
__version__="1.0.2"发布于 2019-05-07 12:30:15
您已经为Python2.7安装了profanity_check
/home/ec2-user/.local/lib/python2.7/site-packages/profanity_check/__init__.py但是您的脚本使用Python3.4运行
#!/usr/bin/python34 <-- this here
from profanity_check import predict, predict_prob将脚本更改为使用python2.7或为python3.7安装profanity_check
https://stackoverflow.com/questions/56022667
复制相似问题