Blender 2.7 MacOS 控制台错误

1 投票
2 回答
1226 浏览
提问于 2025-04-18 04:17

我在我的Mac上使用Blender 2.7(操作系统是10.9.2),但是控制台无法正常打开。如果我打开blender.app/Contents/MacOS/blender,就会出现一个新的终端窗口,但里面全是一些看得懂和看不懂的字符,比如“œ˙Ì˛Ä&àÖÄH__PAGEZERO__TEXTÃÔ。而且Blender也不会在这里显示任何打印信息或错误。

有人知道这是怎么回事吗?

谢谢!

补充:我对终端也不太熟悉,之前试着从/Contents/MacOS目录用“open blender”来打开 :P。如果你从上级目录输入“./blender”,就能正常工作。

如果有人能解释一下发生了什么,或者输入“./文件名”和“open 文件名”之间有什么区别,那就太好了。

2 个回答

0

抱歉如果这个回答没有完全解决你的问题,但跟这个话题有关:

所有Mac用户注意了,这里有个好东西给你们:

基于我自己“烦恼”的经历,以及借鉴了这个家伙(sambler)的想法,我做了一个简单的应用程序,目的是通过终端打开Blender。

---请试试这个应用,安装简单又超级实用---

这里

..是使用方法:

  1. 用Finder找到blender.app。

这里插入图片描述

  1. 右键点击Blender,选择“显示包内容”。

这里插入图片描述

  1. 下载这个应用并解压。

这里插入图片描述

  1. 把这个应用拖到Blender的“Contents”文件夹里。

这里插入图片描述

  1. 把这个应用拖到Dock上,第一次打开它。

这里插入图片描述

  1. (可选)在房间里跳舞,唱歌庆祝你有这样一个应用。




另外,这里是AppleScript的源代码:(目前有很多有用的注释)

set myPath to ((path to current application) as string) --find the path to blenderOpen.app
set myPath to ((characters 1 through ((length of myPath) - 1) of myPath) as string) --rip off the last ":"
set charDelete to (last character of myPath) -- rip off the "blenderOpen.app"
repeat until charDelete = ":" -- rip off the "blenderOpen.app"
    set myPath to ((characters 1 through ((length of myPath) - 1) of myPath) as string) -- rip off the "blenderOpen.app"
    set charDelete to (last character of myPath) -- rip off the "blenderOpen.app"
end repeat
set myPath to myPath & "MacOS" --find the blender runtime by appending this path

set myPath to quoted form of the POSIX path of myPath -- convert path so terminal understands
(*
why this little if statement down below?
This if statement is here because if a user
opens terminal and runs some command,
then afterwards runs our script,
we want to use a new window so as not
to interfere with the user.
However, if WE open terminal,
than we want to use the window 
that terminal just made for us.
*)

if testterminal() then
    tell application "Terminal" to do script "cd " & myPath & " && ./blender" -- tell terminal to open new window, and open blender, Voila!!!
else
    tell application "Terminal" to tell front window to do script "cd " & myPath & " && ./blender" -- tell terminal to open blender, in the current window, Voila!!!
end if


return myPath
on testterminal()
    tell application "System Events" to (name of processes) contains "Terminal"
end testterminal
3

Blender这个软件在运行的时候需要一些资源,这些资源和软件本身放在同一个文件夹里。当你启动Blender时,它会从当前的工作目录开始寻找这些资源。

在终端里输入命令时,系统会按照一个顺序(这个顺序在PATH变量中定义)去查找命令。如果你在命令前加上./,就是告诉系统在当前的工作目录里运行这个命令,而不是去PATH列表里找。

命令open是用来打开可以编辑的文件的,它会认为可以用终端来处理这个文件,但新打开的终端会在你的主目录下启动,这样Blender就找不到它需要的资源了。我已经有几年没用过OSX了,但它可能还会试图把Blender当作一个脚本来运行。不管怎样,open命令并不适合用来运行可执行文件。

所以,open blender就像是在说你想要编辑这个文件,而./blender实际上是在命令行中运行一个应用程序。

你也可以很容易地创建一个苹果脚本,让终端改变工作目录并启动Blender。这个脚本可以保存为一个应用程序,方便你从Finder中启动。我觉得这个方法是(未经测试的)-

tell application "Terminal"
 do script "cd /Applications/blender/blender.app/Contents/MacOS && ./blender"
end tell

如果你只想在运行脚本时看到Python的输出,可以试试这里的脚本 - 它可以让你在Blender的Python控制台中运行脚本,以捕捉输出。

当你需要Blender特定的Python脚本帮助时,可以去blender.stackexchange询问。

撰写回答