luajit:未知的 luaJIT 命令或 jit.* 模块未安装

luajit: unknown luaJIT command or jit.* modules not installed

我正在尝试将 jit 模块 jit.bcsave 与 luajit 一起使用。现在这个问题已被问到这里并标记为答案,但答案对我不起作用:

首先我按照安装指南LuaJit's installation guide

Installing LuaJIT Copy luajit.exe and lua51.dll (built in the src directory) to a newly created directory (any location is ok). Add lua and lua\jit directories below it and copy all Lua files from the src\jit directory of the distribution to the latter directory.

There are no hardcoded absolute path names — all modules are loaded relative to the directory where luajit.exe is installed (see src/luaconf.h).

所以我的文件夹结构是:

- luajit.exe
- lua51.dll
- lua
  - jit
    - bcsave.lua

它仍然找不到我的模块。

我还尝试将 LUA_PATH 环境变量添加到 .....\lua\jit,就像其他问题的答案中建议的那样。我也尝试将其设置为 ....\lua\jit\?.lua,但它仍然不起作用。

我的luajit是2.0(稳定),我的OS是Windows10.

I also tried adding a LUA_PATH environment variable to .....\lua\jit, like it's suggested in that answer of the other question. I also tried setting it to ....\lua\jit\?.lua, but nonetheless it won't work.

您应该将路径添加为 ....\lua\?.lua,因为 jit.bcsave 将扩展为 ....\lua\jit\bcsave.lua

错误消息列出了已尝试定位模块的路径,因此查看这些路径(并在将来包含在问题中)会很有用。