我的cython/ pyximport代码在读/写文件系统上运行良好.
但是(出于测试目的),我需要在只读文件系统上进行尝试.
如何更改cython/pyximport临时目录?(它在哪里完成工作?即即时编译?)
例如,如何将此"工作目录"设置为当前目录以外的其他位置/tmp/(不是ro,但是rw)?
追溯:
!! File "/usr/lib/python2.7/site-packages/Cython/Distutils/build_ext.py", line 301, in cython_sources
self.mkpath(os.path.dirname(target))
!! File "/usr/lib/python2.7/distutils/cmd.py", line 352, in mkpath
dir_util.mkpath(name, mode, dry_run=self.dry_run)
!! File "/usr/lib/python2.7/distutils/dir_util.py", line 76, in mkpath
"could not create '%s': %s" % (head, exc.args[-1]))
!! ImportError: Building module samplerbox_audio failed: ["DistutilsFileError: could not create '/root/.pyxbld': Read-only file system\n"]
Run Code Online (Sandbox Code Playgroud)
Dav*_*idW 14
从 help(pyximport.install)
默认情况下,已编译的模块将最终
.pyxbld位于用户主目录的目录中.传递不同的路径build_dir将覆盖此.
所以build_dir当你打电话pyximport.install让它使用你的读/写系统时传递作为参数.