我对 Python 很陌生。我想使用 libnfs 模块来访问 nfs 卷并执行操作。我直接下载了 libnfs 模块并将其放在 /usr/lib64/python2.7/site-packages 位置,因为 pip install 给出了错误。现在当我运行下面代码
import libnfs
nfs = libnfs.NFS('nfs://host-ip/nfsmnt')
a = nfs.open('/foo-test', mode='w+')
a.write("Test string")
a.close()
print nfs.open('/foo-test', mode='r').read()
我明白了
File "sample.py", line 1, in <module>
import libnfs
File "/usr/lib64/python2.7/site-packages/libnfs/__init__.py", line 19, in <module>
from .libnfs import *
File "/usr/lib64/python2.7/site-packages/libnfs/libnfs.py", line 28, in <module>
_libnfs = swig_import_helper()
File "/usr/lib64/python2.7/site-packages/libnfs/libnfs.py", line 20, in swig_import_helper
import _libnfs
ImportError: No module named _libnfs.
请让我知道如何进行