MAC-关于/usr和/opt

/usr目录包含系统级的文件,如lib中的系统库和bin中的预装程序,随系统升级变化。/usr/local则用于用户安装的软件,不受系统升级影响,其bin目录下的程序可直接执行。/opt也是用户级程序目录,类似D:/Software。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/usr                  系统级的目录  类似C:/Windows

/usr/lib             类似C:/Windows/System32

/usr/bin           系统预装的一些可执行程序,随系统升级会改变

/usr/local         用户级的程序目录,就是用户自己安装的软件默认会到这个目录下。另外/usr/local命令下面的一些子目录往往都是被加入到PATH环境变量中,这样安装在/usr/local目录下的软件就可以在命令行执行、启动。 类似C:/Progrem Files

/usr/local/bin   用户安装的可执行程序,不受系统升级影响,用户编译安装软件时,一般放到/usr/local目录下

/usr/src            系统级的源码目录

/usr/local/src  用户级的源码目录

/opt                   用户级的程序目录  类似D:/Software

https://blog.youkuaiyun.com/m0_62012366/article/details/120484746

stellaechen@STELLAECHEN-MC1 ~ % make make: *** No targets specified and no makefile found. Stop. stellaechen@STELLAECHEN-MC1 ~ % cd download stellaechen@STELLAECHEN-MC1 download % cd Python-2.7.13 stellaechen@STELLAECHEN-MC1 Python-2.7.13 % make running build running build_ext building '_Qt' extension gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/stellaechen/download/Python-2.7.13/Mac/Include -I. -IInclude -I./Include -I/usr/local/include -I/Users/stellaechen/download/Python-2.7.13/Include -I/Users/stellaechen/download/Python-2.7.13 -c /Users/stellaechen/download/Python-2.7.13/Mac/Modules/qt/_Qtmodule.c -o build/temp.macosx-15.4-arm64-2.7/Users/stellaechen/download/Python-2.7.13/Mac/Modules/qt/_Qtmodule.o -Wno-deprecated-declarations /Users/stellaechen/download/Python-2.7.13/Mac/Modules/qt/_Qtmodule.c:28003:15: warning: variable 'm' set but not used [-Wunused-but-set-variable] 28003 | PyObject *m; | ^ 1 warning generated. gcc -bundle -undefined dynamic_lookup build/temp.macosx-15.4-arm64-2.7/Users/stellaechen/download/Python-2.7.13/Mac/Modules/qt/_Qtmodule.o -L/usr/local/lib -o build/lib.macosx-15.4-arm64-2.7/_Qt.so -framework QuickTime -framework Carbon ld: framework 'QuickTime' not found clang: error: linker command failed with exit code 1 (use -v to see invocation) building '_tkinter' extension gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DWITH_APPINIT=1 -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tcl.framework/Versions/Current/PrivateHeaders -I/System/Library/Frameworks/Tk.framework/Headers -I/System/Library/Frameworks/Tk.framework/Versions/Current/PrivateHeaders -I/usr/X11R6/include -I/Users/stellaechen/download/Python-2.7.13/Mac/Include -I. -IInclude -I./Include -I/usr/local/include -I/Users/stellaechen/download/Python-2.7.13/Include -I/Users/stellaechen/download/Python-2.7.13 -c /Users/stellaechen/download/Python-2.7.13/Modules/_tkinter.c -o build/temp.macosx-15.4-arm64-2.7/Users/stellaechen/download/Python-2.7.13/Modules/_tkinter.o -framework Tk clang: warning: -framework Tk: 'linker' input unused [-Wunused-command-line-argument] In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_tkinter.c:71: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/tk.h:86:11: fatal error: 'X11/Xlib.h' file not found 86 | # include <X11/Xlib.h> | ^~~~~~~~~~~~ 1 error generated. building '_ctypes' extension gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I_ctypes/darwin -I/Users/stellaechen/download/Python-2.7.13/Mac/Include -I/Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include -I/Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/powerpc -I. -IInclude -I./Include -I/usr/local/include -I/Users/stellaechen/download/Python-2.7.13/Include -I/Users/stellaechen/download/Python-2.7.13 -c /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.c -o build/temp.macosx-15.4-arm64-2.7/Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.o -DMACOSX In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.c:113: /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:65:3: error: "Unsupported MacOS X CPU type" 65 | # error "Unsupported MacOS X CPU type" | ^ In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.c:113: In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:73: /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffitarget.h:12:2: error: "Unsupported CPU type" 12 | #error "Unsupported CPU type" | ^ In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.c:113: In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:74: /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/fficonfig.h:51:2: error: "Unknown CPU type" 51 | #error "Unknown CPU type" | ^ In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.c:113: /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:171:5: error: unknown type name 'ffi_abi' 171 | ffi_abi abi; | ^ /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:193:2: error: unknown type name 'ffi_sarg' 193 | ffi_sarg sint; | ^ /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:194:2: error: unknown type name 'ffi_arg' 194 | ffi_arg uint; | ^ /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:307:11: error: unknown type name 'ffi_abi' 307 | ffi_abi abi, | ^ In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.c:129: /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/ctypes.h:99:5: error: unknown type name 'ffi_closure' 99 | ffi_closure *pcl_write; /* the C callable, writeable */ | ^ 8 errors generated. Python build finished, but the necessary bits to build these modules were not found: _bsddb _curses _curses_panel _sqlite3 _ssl bsddb185 bz2 dbm dl gdbm imageop linuxaudiodev nis ossaudiodev readline spwd sunaudiodev zlib To find the necessary bits, look in setup.py in detect_modules() for the module's name. Failed to build these modules: _ctypes _Qt _tkinter running build_scripts stellaechen@STELLAECHEN-MC1 Python-2.7.13 %
07-05
stellaechen@STELLAECHEN-MC1 Python-2.7.13 % make ./python.exe -E -S -m sysconfig --generate-posix-vars ;\ if test $? -ne 0 ; then \ echo "generate-posix-vars failed" ; \ rm -f ./pybuilddir.txt ; \ exit 1 ; \ fi running build running build_ext building '_Qt' extension gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/stellaechen/download/Python-2.7.13/Mac/Include -I. -IInclude -I./Include -I/usr/local/include -I/Users/stellaechen/download/Python-2.7.13/Include -I/Users/stellaechen/download/Python-2.7.13 -c /Users/stellaechen/download/Python-2.7.13/Mac/Modules/qt/_Qtmodule.c -o build/temp.macosx-15.4-arm64-2.7/Users/stellaechen/download/Python-2.7.13/Mac/Modules/qt/_Qtmodule.o -Wno-deprecated-declarations error: unable to open output file 'build/temp.macosx-15.4-arm64-2.7/Users/stellaechen/download/Python-2.7.13/Mac/Modules/qt/_Qtmodule.o': 'Operation not permitted' 1 error generated. building '_tkinter' extension gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DWITH_APPINIT=1 -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tcl.framework/Versions/Current/PrivateHeaders -I/System/Library/Frameworks/Tk.framework/Headers -I/System/Library/Frameworks/Tk.framework/Versions/Current/PrivateHeaders -I/usr/X11R6/include -I/Users/stellaechen/download/Python-2.7.13/Mac/Include -I. -IInclude -I./Include -I/usr/local/include -I/Users/stellaechen/download/Python-2.7.13/Include -I/Users/stellaechen/download/Python-2.7.13 -c /Users/stellaechen/download/Python-2.7.13/Modules/_tkinter.c -o build/temp.macosx-15.4-arm64-2.7/Users/stellaechen/download/Python-2.7.13/Modules/_tkinter.o -framework Tk clang: warning: -framework Tk: 'linker' input unused [-Wunused-command-line-argument] In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_tkinter.c:71: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/tk.h:86:11: fatal error: 'X11/Xlib.h' file not found 86 | # include <X11/Xlib.h> | ^~~~~~~~~~~~ 1 error generated. building '_ctypes' extension gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I_ctypes/darwin -I/Users/stellaechen/download/Python-2.7.13/Mac/Include -I/Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include -I/Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/powerpc -I. -IInclude -I./Include -I/usr/local/include -I/Users/stellaechen/download/Python-2.7.13/Include -I/Users/stellaechen/download/Python-2.7.13 -c /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.c -o build/temp.macosx-15.4-arm64-2.7/Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.o -DMACOSX In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.c:113: /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:65:3: error: "Unsupported MacOS X CPU type" 65 | # error "Unsupported MacOS X CPU type" | ^ In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.c:113: In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:73: /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffitarget.h:12:2: error: "Unsupported CPU type" 12 | #error "Unsupported CPU type" | ^ In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.c:113: In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:74: /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/fficonfig.h:51:2: error: "Unknown CPU type" 51 | #error "Unknown CPU type" | ^ In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.c:113: /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:171:5: error: unknown type name 'ffi_abi' 171 | ffi_abi abi; | ^ /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:193:2: error: unknown type name 'ffi_sarg' 193 | ffi_sarg sint; | ^ /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:194:2: error: unknown type name 'ffi_arg' 194 | ffi_arg uint; | ^ /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/libffi_osx/include/ffi.h:307:11: error: unknown type name 'ffi_abi' 307 | ffi_abi abi, | ^ In file included from /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/_ctypes.c:129: /Users/stellaechen/download/Python-2.7.13/Modules/_ctypes/ctypes.h:99:5: error: unknown type name 'ffi_closure' 99 | ffi_closure *pcl_write; /* the C callable, writeable */ | ^ 8 errors generated. Python build finished, but the necessary bits to build these modules were not found: _bsddb _curses _curses_panel _sqlite3 _ssl bsddb185 bz2 dbm dl gdbm imageop linuxaudiodev nis ossaudiodev readline spwd sunaudiodev zlib To find the necessary bits, look in setup.py in detect_modules() for the module's name. Failed to build these modules: _ctypes _Qt _tkinter running build_scripts stellaechen@STELLAECHEN-MC1 Python-2.7.13 % make install /usr/bin/install -c python.exe /usr/local/bin/python2.7 install: /usr/local/bin/INS@20xsco: Permission denied make: *** [altbininstall] Error 71 stellaechen@STELLAECHEN-MC1 Python-2.7.13 %
最新发布
07-05
<think>嗯,用户的问题是关于在Mac系统中配置icu4c后仍然找不到icu-i18n包的问题,尤其是如何正确设置PKG_CONFIG_PATH让pkg-config能找到这个包。首先,我需要回忆一下相关的知识,比如pkg-config的作用,PKG_CONFIG_PATH环境变量的用途,以及icu4c的安装路径通常在哪里。 首先,pkg-config是用来帮助查找库文件头文件的工具,它会根据.pc文件中的信息提供编译链接所需的参数。PKG_CONFIG_PATH这个环境变量就是告诉pkg-config去哪里查找这些.pc文件。用户已经尝试过设置这个变量,但似乎没有生效,所以需要进一步排查。 接下来,我需要考虑icu4c的安装位置。在Mac上,如果用Homebrew安装的话,通常路径是/usr/local/opt/icu4c。不过不同的版本可能路径不同,比如用户提到过安装旧版本icu4c 62.1,可能路径会有变化。这时候需要确认具体的安装路径是否正确,是否存在对应的lib/pkgconfig目录,并且该目录下是否有icu-i18n.pc文件。 可能的步骤包括: 1. 确认icu4c的安装路径是否正确,检查是否存在.pc文件。 2. 检查PKG_CONFIG_PATH是否正确地包含该路径,是否在zshrc中正确设置。 3. 确保环境变量生效,可能需要重启终端或者执行source ~/.zshrc。 4. 使用pkg-config命令手动测试是否能找到包。 用户可能的问题包括路径设置错误,比如路径拼写错误,或者没有包含正确的子目录(比如lib/pkgconfig)。另外,可能安装的版本不对,导致.pc文件不存在。还有可能环境变量没有正确加载,比如修改了.zshrc但没有source,或者有其他配置文件覆盖了变量。 此外,用户可能参考了之前的解决方案,比如引用[1]中的设置,但可能路径需要根据实际安装情况调整。例如,如果Homebrew安装的icu4c版本不同,路径中的版本号可能不同,比如/usr/local/opt/icu4c@62.1/lib/pkgconfig,这时候需要检查具体的路径是否存在。 另外,引用[2]提到使用CMake的find_packagepkg-config的方法,可能需要确保pkg-config能够正确找到库,否则CMake也会失败。用户的问题可能出现在构建过程中,使用pkg-config时找不到库,导致编译错误。 可能的解决方案是分步骤指导用户检查路径,设置环境变量,并验证是否生效。同时,提醒用户注意版本差异路径的正确性。例如,使用brew --prefix icu4c来获取实际的安装路径,确保路径正确无误。然后,将路径添加到PKG_CONFIG_PATH中,并导出变量。最后,用pkg-config --libs --cflags icu-i18n来测试是否成功。 用户可能还遇到了其他相关问题,比如安装多个版本导致的冲突,或者权限问题,但当前问题主要集中在PKG_CONFIG_PATH的设置上,所以需要优先解决路径问题。另外,用户可能没有意识到需要重启终端或者source配置文件,导致变量未生效,这也是需要提醒的地方。</think>### 解决Mac系统中配置icu4c后找不到icu-i18n包的问题 #### 步骤1:确认icu4c的安装路径 通过Homebrew安装的icu4c通常位于以下路径: $$/usr/local/opt/icu4c$$ 使用命令验证具体路径: ```bash brew --prefix icu4c ``` 如果安装的是旧版本(如62.1),路径可能包含版本号: $$/usr/local/opt/icu4c@62.1$$[^3] --- #### 步骤2:设置PKG_CONFIG_PATH 1. 在`~/.zshrc`中添加环境变量: ```bash # 通用路径(根据实际安装路径调整) export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/icu4c/lib/pkgconfig" # 如果使用旧版本(例如62.1) export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/icu4c@62.1/lib/pkgconfig" ``` 2. 使配置生效: ```bash source ~/.zshrc ``` --- #### 步骤3:验证pkg-config是否能找到包 运行以下命令检查是否能正确返回路径: ```bash pkg-config --libs --cflags icu-i18n ``` 若输出包含`-I/usr/local/opt/icu4c/include -L/usr/local/opt/icu4c/lib`等路径,则配置成功[^1][^2]。 --- #### 补充说明 1. **路径权限问题**:确保路径`/usr/local/opt/icu4c/lib/pkgconfig`存在且可读。 2. **多版本冲突**:如果安装了多个icu4c版本,需明确指定目标版本的路径。 3. **构建工具适配**:在CMake或Makefile中,通过`pkg_check_modules(ICU REQUIRED icu-i18n)`调用[^2]。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ZHOU_VIP

您的鼓励将是我创作最大的动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值