即使安装了command -v c-blosc,使用它也不会返回任何结果
c-blosc将自己描述为一个压缩库,所以它不是命令
我试过的几件事
% c-blosc
zsh: command not found: c-blosc
where c-blosc
c-blosc not found
brew install c-blosc
...
Warning: c-blosc 1.21.0 is already installed and up-to-date.
To reinstall 1.21.0, run:
brew reinstall c-blosc
% brew info c-blosc
c-blosc: stable 1.21.0 (bottled)
Blocking, shuffling and loss-less compression library
https://blosc.org/
/usr/local/Cellar/c-blosc/1.21.0 (10 files, 1.7MB) *
Poured from bottle on 2021-07-07 at 23:44:40
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/c-blosc.rb
License: BSD-3-Clause
==> Dependencies
Build: cmake ✘
==> Analytics
install: 312 (30 days), 1,190 (90 days), 3,168 (365 days)
install-on-request: 249 (30 days), 998 (90 days), 2,263 (365 days)
build-error: 0 (30 days)
brew search c-blosc
==> Formulae
c-blosc ✔以下是
if [ brew info c-blosc 2>&1 >/dev/null ]; then
echo "Installed"
else
echo "Nope"
fi和
if [ brew search c-blosc 2>&1 >/dev/null ]; then
echo "Installed"
else
echo "Nope"
fi尽管我已经安装了Nope,但两者都打印它
发布于 2021-07-13 05:41:02
根据https://apple.stackexchange.com/q/145437的说法,你可以
brew info c-blosc它将打印安装位置等信息。您可以使用相关命令,如search
brew search c-blosc唯一显式返回丢失公式的失败代码的记录在案命令是
brew --prefix --installed c-blosc它没有具体的输出,所以您可以这样做。
if brew --prefix --installed c-blosc 2>/dev/null; then
echo "Installed"
else
echo "Nope"
fi发布于 2021-07-14 07:09:18
由于c-blosc包不包含任何命令,因此您将无法找到是否使用以下任何一种方法安装它:
command c-blosc
type c-blosc包实际上提供了一个动态链接库和一个头文件,您可以通过使用以下命令列出包的内容来查看该文件:
brew ls c-blosc
/usr/local/Cellar/c-blosc/1.21.0/include/ (2 files)
/usr/local/Cellar/c-blosc/1.21.0/lib/libblosc.1.21.0.dylib
/usr/local/Cellar/c-blosc/1.21.0/lib/pkgconfig/blosc.pc
/usr/local/Cellar/c-blosc/1.21.0/lib/ (3 other files)现在,homebrew在/usr/local/lib中创建符号链接,让您将程序链接到-让我们看看:
ls -l /usr/local/lib/*blosc*
lrwxr-xr-x 1 mark admin 50 14 Jul 07:52 /usr/local/lib/libblosc.1.21.0.dylib -> ../Cellar/c-blosc/1.21.0/lib/libblosc.1.21.0.dylib
lrwxr-xr-x 1 mark admin 45 14 Jul 07:52 /usr/local/lib/libblosc.1.dylib -> ../Cellar/c-blosc/1.21.0/lib/libblosc.1.dylib
lrwxr-xr-x 1 mark admin 39 14 Jul 07:52 /usr/local/lib/libblosc.a -> ../Cellar/c-blosc/1.21.0/lib/libblosc.a
lrwxr-xr-x 1 mark admin 43 14 Jul 07:52 /usr/local/lib/libblosc.dylib -> ../Cellar/c-blosc/1.21.0/lib/libblosc.dylib因此,无论版本如何,其中最通用的测试是libblosc.dylib,因此我将使用它作为测试:
if [ -e /usr/local/lib/libblosc.dylib ] ; then echo "Installed" ; fi请注意,您可以更显式地测试该文件--现有的和作为一个带有if [ -L ... ]的符号链接--但是如果liblosc是通过某种非符号链接方法安装的,例如可以从源中将实际库复制到该位置而不是创建一个符号链接,则可能无法进行测试。
另一个可以使用的可选命令如下所示,它显示了在何处安装了给定的自制包:
brew --prefix --installed c-blosc
/usr/local/opt/c-blosc
echo $?
0相对于:
brew --prefix --installed MadeUpNonExistentPackage
Error: No available formula with the name "madeupnonexistentpackage".
echo $?
1https://stackoverflow.com/questions/68333411
复制相似问题