- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试让 profanity_check 在 EC2 Linux 实例上运行。
问题是当我尝试使用 python34 profanity.py
.
此外,当尝试运行 python profanity.py
时,我得到一个 ValueError: unsupported pickle protocol: 3
错误。
我认为这是因为 profanity_check 只适用于 Python 3。
此外,当我安装 profanity-check 时,我收到了 DEPRECATION: Python 2.7 will reach the end of its life
警告。但是,我已经在系统上安装了 Python 3.4.9。
根据本期here我已经检查了 __init__.py
文件。它存在并且看起来稳定。
__init__.py
文件的路径如下:
/home/ec2-user/.local/lib/python2.7/site-packages/profanity_check/init.py
这可能是什么问题?
亵渎.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"
最佳答案
您已经为 Python 2.7 安装了 profanity_check
/home/ec2-user/.local/lib/python2.7/site-packages/profanity_check/__init__.py
但是你的脚本是使用 Python 3.4 运行的
#!/usr/bin/python34 <-- this here
from profanity_check import predict, predict_prob
更改脚本以使用 python2.7 或为 python3.7 安装 profanity_check
关于python - 如何处理 'ImportError: No module named profanity_check',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56022667/
我正在尝试让 profanity_check 在 EC2 Linux 实例上运行。 问题是当我尝试使用 python34 profanity.py. 此外,当尝试运行 python profanity
我是一名优秀的程序员,十分优秀!