简体   繁体   English

从命令行启动IPython qtconsole(安装所有依赖项后)

[英]Launching IPython qtconsole from command line (after installing all dependencies)

I am a bit of a newbie to the command line. 我是命令行的新手。 I used to have IPython (with all dependencies configured) on my last MacBook, such that I could click on an icon from the dash to launch iPython qtconsole (outside of terminal shell). 我曾经在我的上一台MacBook上安装了IPython(配置了所有依赖项),这样我就可以点击破折号上的图标来启动iPython qtconsole(在终端shell之外)。

Now, on my new MacBook Pro, after installing all of the same files and dependencies, I am getting: 现在,在我的新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

and, again being a newbie, I think part of the problem may rely on the output, here: 而且,再次成为新手,我认为问题的一部分可能依赖于输出,这里:

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

Thanks in an advance for any tips. 感谢任何提示。 And if you need me to run any command (to view more outputs) just let me know! 如果你需要我运行任何命令(查看更多输出),请告诉我!

So, you have multiple Python installations, and aren't sure which one you have. 因此,您有多个Python安装,并且不确定您拥有哪个。

You have both Homebrew and MacPorts. 你有Homebrew和MacPorts。

Your MacPorts is broken and you don't know how to fix it. 您的MacPorts已损坏,您不知道如何解决它。

Fixing each of these may not be that hard, but I think it's time to wipe the slate clean and start over. 修复这些可能并不那么难,但我认为现在是时候擦干净并重新开始了。


The "easy" way to do this is to reinstall the OS, using the standard backup-and-migrate stuff to preserve your Aqua-level apps, user preferences, documents, etc. But that's pretty drastic, and shouldn't be necessary. “简单”的方法是重新安装操作系统,使用标准的备份和迁移功能来保存您的Aqua级应用程序,用户首选项,文档等。但这非常激烈,而且不应该是必要的。

To clean things up manually, first: 要手动清理,首先:

  • Uninstall MacPorts . 卸载MacPorts
  • brew uninstall $(brew list) . brew uninstall $(brew list) This removes all Homebrew packages. 这将删除所有Homebrew包。 You could just unlink instead of uninstall , but you really want to rebuild them once your machine is cleaned up. 可以 unlink而不是uninstall ,但是您确实希望在清理机器后重建它们。
  • sudo rm -rf /Library/Python /Library/Frameworks/Python.framework /usr/local/share/python* . sudo rm -rf /Library/Python /Library/Frameworks/Python.framework /usr/local/share/python* This wipes out most third-party Python installations. 这消除了大多数第三方Python安装。 And if you don't know where yours came from, it's really the best you can do. 如果你不知道你的来自哪里,那你真的是最好的。

Take a look at whatever's left in /usr/local/bin . 看看/usr/local/bin的剩余内容。 All kinds of stuff can end up here, from scripts installed with Apple's Python to the command-line tools for GUI apps like TextMate, Aquamacs, or GitHub to the tools that come with binary installs of SDL or Qt, so you may not want to just wipe out the whole thing—but you do want to look it all over. 各种各样的东西都可以在这里结束,从安装了Apple Python的脚本到GUI应用程序(如TextMate,Aquamacs或GitHub)的命令行工具,再到二进制安装SDL或Qt的工具,所以你可能不想只是消灭了整个事情 - 但你确实想要看一遍。 Also look at /usr/local/lib and /Library/Frameworks . 另请查看/usr/local/lib/Library/Frameworks

You also may need to edit your ~/.profile , etc. files to undo changes you or those installers may have made, like adding /opt/local/bin or /Library/Frameworks/Python.framework/Versions/2.7/bin to your PATH . 您还可能需要编辑~/.profile等文件以撤消您或那些安装程序可能进行的更改,例如添加/opt/local/bin/Library/Frameworks/Python.framework/Versions/2.7/bin你的PATH There could also be changes in /etc , but that's less likely (and less likely to cause problems). /etc可能有变化,但不太可能(并且不太可能导致问题)。

Now run brew doctor to make sure Homebrew is happy, reinstall any non-Python-related Homebrew packages and binary installers you want, and now you're ready to install/configure your python, PyQt4-or-PySide, iPython, etc. properly and live happily every after (until you buy a new computer next year). 现在运行brew doctor以确保Homebrew很高兴,重新安装任何非Python相关的Homebrew软件包和二进制安装程序,现在您已准备好正确安装/配置python,PyQt4或PySide,iPython等。每一次幸福生活(直到明年你买一台新电脑)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM