我们最近在BigData Cluster的Linux服务器上从Git安装了pykakasi
软件包。
安装后,我尝试使用“自述文件”中的测试程序,并收到此错误。
收到错误:
PermissionError: [Errno 13] Permission denied: '/opt/python/python35/lib/python3.5/site-packages/pykakasi/kanwadict3.db/data'
我试图研究Git上报告的所有问题。另外,在此论坛和其他论坛中搜索了可能的解决方案,但没有任何效果。
我正在测试的程序:
import pykakasi
text = u"かな漢字交じり文"
kakasi = pykakasi.kakasi()
kakasi.setMode("H","a") # Hiragana to ascii, default: no conversion
kakasi.setMode("K","a") # Katakana to ascii, default: no conversion
kakasi.setMode("J","a") # Japanese to ascii, default: no conversion
kakasi.setMode("r","Hepburn") # default: use Hepburn Roman table
kakasi.setMode("s", True) # add space, default: no separator
kakasi.setMode("C", True) # capitalize, default: no capitalize
conv = kakasi.getConverter()
result = conv.do(text)
print(result)
预期输出:kana Kanji Majiri Bun
详细错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/python/python35/lib/python3.5/site-packages/pykakasi/kakasi.py", line 99, in getConverter
self._conv["J"] = J2(self._mode["J"], method=self._option["r"])
File "/opt/python/python35/lib/python3.5/site-packages/pykakasi/j2.py", line 48, in __init__
self._kanwa = kanwa()
File "/opt/python/python35/lib/python3.5/site-packages/pykakasi/kanwa.py", line 32, in __init__
self._kanwadict = dbm.open(dictpath, 'r')
File "/opt/python/python35/lib/python3.5/site-packages/semidbm/db.py", line 355, in open
return _SemiDBMReadOnly(filename, **kwargs)
File "/opt/python/python35/lib/python3.5/site-packages/semidbm/db.py", line 40, in __init__
self._load_db()
File "/opt/python/python35/lib/python3.5/site-packages/semidbm/db.py", line 49, in _load_db
self._data_fd = os.open(self._data_filename, compat.DATA_OPEN_FLAGS)
PermissionError: [Errno 13] Permission denied: '/opt/python/python35/lib/python3.5/site-packages/pykakasi/kanwadict3.db/data'