专业的编程技术博客社区

网站首页 > 博客文章 正文

安装luasocket模块提示"sudo: luarocks:找不到命令"如何解决?

baijin 2024-12-28 23:06:55 博客文章 9 ℃ 0 评论

大家好,我是袁庭新。分享一个我在使用luarocks来安装luarocks模块报错的解决方法。

在Unix系统中安装LuaRocks。本文我以CentOS 7.x系统为例,来讲解如何安装LuaRocks。

$ cd /opt
$ wget https://luarocks.org/releases/luarocks-3.11.1.tar.gz
$ tar zxpf luarocks-3.11.1.tar.gz
$ cd luarocks-3.11.1$ ./configure && make && sudo make install
$ luarocks install luasocket
$ lua
Lua 5.4.7  Copyright (C) 1994-2024 Lua.org, PUC-Rio
> require "socket"
table: 0xd196700  /usr/local/share/lua/5.4/socket.lua

这里需要注意的是,如果按照LuaRocks官方文档使用sudo luarocks install luasocket命令来安装luasocket模块,提示"sudo: luarocks:找不到命令"的信息,如下所示。解决这个问题的方法是,将sudo luarocks install luasocket命令中的sudo去掉,然后再执行该命令。如果没有出现该问题,请忽略此步骤的操作。

# sudo luarocks install luasocket
sudo: luarocks:找不到命令

查看已安装的luasocket模块的信息描述。

$ luarocks show luasocket

在LuaRocks包管理器中卸载luasocket模块(移除模块)。

$ luarocks remove luasocket

如果想在Windows系统上安装LuaRocks,可参考https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Windows文档,但这里不推荐这么做。

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表