我是命令行的新手。我曾经在我的上一台MacBook上安装了IPython(配置了所有依赖项),这样我就可以点击破折号上的图标来启动iPython qtconsole(在终端shell之外)。
现在,在我的新MacBook Pro上,在安装了所有相同的文件和依赖项之后,我得到了:
Jacobs-MacBook-Pro:~ Jacob$ ipython qtconsole
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 8, in <module>
load_entry_point('ipython==1.0.dev', 'console_scripts', 'ipython')()
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/frontend/terminal/ipapp.py", line 390, in launch_new_instance
app.initialize()
File "<string>", line 2, in initialize
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/config/application.py", line 84, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/frontend/terminal/ipapp.py", line 315, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<string>", line 2, in initialize
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/config/application.py", line 84, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/core/application.py", line 323, in initialize
self.parse_command_line(argv)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/frontend/terminal/ipapp.py", line 310, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<string>", line 2, in parse_command_line
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/config/application.py", line 84, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/config/application.py", line 429, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<string>", line 2, in initialize_subcommand
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/config/application.py", line 84, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/config/application.py", line 361, in initialize_subcommand
subapp = import_item(subapp)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/utils/importstring.py", line 40, in import_item
module = __import__(package,fromlist=[obj])
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/frontend/qt/console/qtconsoleapp.py", line 56, in <module>
from IPython.external.qt import QtCore, QtGui
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/external/qt.py", line 23, in <module>
QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/external/qt_loaders.py", line 241, in load_qt
result = loaders[api]()
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/external/qt_loaders.py", line 171, in import_pyqt4
from PyQt4 import QtGui, QtCore, QtSvg
ImportError: dlopen(/Library/Python/2.7/site-packages/PyQt4/QtGui.so, 2): Library not loaded: /usr/local/lib/QtGui.framework/Versions/4/QtGui
Referenced from: /Library/Python/2.7/site-packages/PyQt4/QtGui.so
Reason: image not found
并再次成为新手,我认为部分问题可能依赖于输出,这里:
Jacobs-MacBook-Pro:~ Jacob$ brew install qt
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
Warning: qt-4.8.4 already installed, it's just not linked
感谢您提前获取任何提示。如果你需要我运行任何命令(查看更多输出),请告诉我!
答案 0 :(得分:2)
因此,您有多个Python安装,并且不确定您拥有哪个。
你有Homebrew和MacPorts。
你的MacPorts坏了,你不知道如何解决它。
修复这些可能并不那么难,但我认为现在是时候擦干净并重新开始了。
执行此操作的“简单”方法是重新安装操作系统,使用标准的备份和迁移功能来保存您的Aqua级应用程序,用户首选项,文档等。但这非常激烈,而且不应该是必要的。
首先手动清理:
brew uninstall $(brew list)
。这将删除所有Homebrew包。您只能{/ 1}}而不是unlink
,但您确实希望在清理机器后重建它们。uninstall
。这消除了大多数第三方Python安装。如果你不知道你的来自哪里,那真是你能做的最好的。看看sudo rm -rf /Library/Python /Library/Frameworks/Python.framework /usr/local/share/python*
中的剩余内容。各种各样的东西都可以在这里结束,从安装了Apple Python的脚本到GUI应用程序(如TextMate,Aquamacs或GitHub)的命令行工具,再到二进制安装SDL或Qt的工具,所以你可能不想只是消灭了整个事情 - 但你确实想要看一遍。另请查看/usr/local/bin
和/usr/local/lib
。
您还可能需要修改/Library/Frameworks
等文件,以撤消您或安装人员可能做出的更改,例如将~/.profile
或/opt/local/bin
添加到/Library/Frameworks/Python.framework/Versions/2.7/bin
。 可以也可以在PATH
中进行更改,但这种可能性较小(并且不太可能导致问题)。
现在运行/etc
以确保Homebrew满意,重新安装所需的任何非Python相关的Homebrew软件包和二进制安装程序,现在您已准备好安装/配置python,PyQt4或PySide ,iPython等,每一次都很合适,幸福生活(直到明年你买一台新电脑)。