我需要一些建议。我已经安装了ipython(sudo pip install ipython [all])
我是python 2.7,mac osx 10.9 64bits。
我正在尝试午餐qtconsole
camilo-mbp:mvc cami$ ipython qtconsole
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 8, in <module>
load_entry_point('ipython==2.2.0', 'console_scripts', 'ipython')()
File "/Library/Python/2.7/site-packages/IPython/__init__.py", line 120, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 563, in launch_instance
app.initialize(argv)
File "<string>", line 2, in initialize
File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/IPython/terminal/ipapp.py", line 321, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<string>", line 2, in initialize
File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/IPython/core/application.py", line 381, in initialize
self.parse_command_line(argv)
File "/Library/Python/2.7/site-packages/IPython/terminal/ipapp.py", line 316, 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/config/application.py", line 92, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 475, 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/config/application.py", line 92, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/IPython/config/application.py", line 406, in initialize_subcommand
subapp = import_item(subapp)
File "/Library/Python/2.7/site-packages/IPython/utils/importstring.py", line 42, in import_item
module = __import__(package, fromlist=[obj])
File "/Library/Python/2.7/site-packages/IPython/qt/console/qtconsoleapp.py", line 58, in <module>
from IPython.external.qt import QtCore, QtGui
File "/Library/Python/2.7/site-packages/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/external/qt_loaders.py", line 258, in load_qt
api_options))
ImportError:
Could not load requested Qt binding. Please ensure that
PyQt4 >= 4.7 or PySide >= 1.0.3 is available,
and only one is imported per session.
Currently-imported Qt library: None
PyQt4 installed: False
PySide >= 1.0.3 installed: False
Tried to load: ['pyside']
我已完成以下命令将pyQt4安装为True并且工作正常
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
现在,我想安装pyside,但我有一些错误:
camilo-mbp:mvc cami$ pip install pyside
Downloading/unpacking pyside
Downloading PySide-1.2.2.tar.gz (9.3MB): 9.3MB downloaded
Running setup.py egg_info for package pyside
Removing /private/var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip_build_cami/pyside/pyside_package
package init file 'pyside_package/PySide/__init__.py' not found (or not a regular file)
package init file 'pyside_package/pysideuic/__init__.py' not found (or not a regular file)
warning: no previously-included files matching '**' found under directory 'sources/pyside-examples/examples/hyperui'
warning: no previously-included files matching '**' found under directory 'sources/pyside-examples/mobility'
warning: no previously-included files matching '**' found under directory 'sources/shiboken/.git'
warning: no previously-included files matching '**' found under directory 'sources/pyside/.git'
warning: no previously-included files matching '**' found under directory 'sources/pyside-tools/.git'
warning: no previously-included files matching '**' found under directory 'sources/pyside-examples/.git'
warning: no files found matching '**' under directory 'pyside_package/PySide'
warning: no files found matching '**' under directory 'pyside_package/PySide/docs'
warning: no files found matching '**' under directory 'pyside_package/PySide/plugins'
warning: no files found matching '**' under directory 'pyside_package/PySide/imports'
warning: no files found matching '**' under directory 'pyside_package/PySide/translations'
warning: no files found matching '**' under directory 'pyside_package/PySide/include'
warning: no files found matching '**' under directory 'pyside_package/PySide/typesystems'
warning: no files found matching '**' under directory 'pyside_package/PySide/examples'
warning: no files found matching '**' under directory 'pyside_package/pysideuic'
warning: no files found matching '**' under directory 'pyside_package/pysideuic/Compiler'
warning: no files found matching '**' under directory 'pyside_package/pysideuic/port_v2'
warning: no files found matching '**' under directory 'pyside_package/pysideuic/port_v3'
warning: no files found matching '**' under directory 'pyside_package/pysideuic/widget-plugins'
Installing collected packages: pyside
Running setup.py install for pyside
Removing /private/var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip_build_cami/pyside/pyside_package
Python architecture is 64bit
error: Failed to find cmake. Please specify the path to cmake with --cmake parameter.
Complete output from command /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/private/var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip_build_cami/pyside/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip-AjpsAb-record/install-record.txt --single-version-externally-managed:
Removing /private/var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip_build_cami/pyside/pyside_package
running install
running build
Python architecture is 64bit
error: Failed to find cmake. Please specify the path to cmake with --cmake parameter.
----------------------------------------
Cleaning up...
Command /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python - c "import setuptools;__file__='/private/var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip_build_cami/pyside/s etup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install -- record /var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip-AjpsAb-record/install-record.txt -- single-version-externally-managed failed with error code 1 in /private/var/folders/y3/xwgxtgzs27z5mwzhpmw244d00000gp/T/pip_build_cami/pyside
Storing complete log in /Users/cami/Library/Logs/pip.log
我尝试安装cmake
camilo-mbp:mvc cami$ pip install cmake
Downloading/unpacking cmake
Could not find any downloads that satisfy the requirement cmake
Cleaning up...
No distributions at all found for cmake
Storing complete log in /Users/cami/Library/Logs/pip.log
camilo-mbp:mvc cami$
我还应该怎么办?
提前致谢
答案 0 :(得分:3)
因为我知道,cmake不是python包。它是一个构建工具。所以,你所要做的就是安装它。你可以从这里得到它:CMake site
此外,您应该检查Apple开发工具是否确实具有cmake。
答案 1 :(得分:2)
有关在MacOSX上构建和安装PySide的文档在http://pyside.readthedocs.org/en/latest/building/macosx.html
答案 2 :(得分:0)
问题语句Qtconsole导入错误或冲突。
这是我收到的确切错误消息
File "uikit/ipython.py", line 5, in <module>
ImportError: No module named qt.console.rich_ipython_widget
[28603] Failed to execute script bosetap
Currently-imported Qt library: 'pyqt'
PyQt4 installed: False
PyQt5 installed: False
PySide >= 1.0.3 installed: False
PySide2 installed: False
Tried to load: ['pyqt']
您可以深入研究uikit / ipython.py,然后看到在导入新库与旧库以及以下库之间存在一个try catch块。
QT_API = os.environ.get('QT_API', None)
if QT_API not in [QT_API_PYSIDE, QT_API_PYSIDE2, QT_API_PYQT, QT_API_PYQT5, None]:
raise RuntimeError("Invalid Qt API %r, valid values are: %r, %r, %r, %r" %
(QT_API, QT_API_PYSIDE, QT_API_PYSIDE2, QT_API_PYQT, QT_API_PYQT5))
if QT_API is None:
api_opts = [QT_API_PYQT5, QT_API_PYSIDE2, QT_API_PYSIDE, QT_API_PYQT]
else:
api_opts = [QT_API]
步骤1) 我开始在python提示符下手动运行事物,并说服自己qt.console已正确安装。如果找到,则无法执行此操作。安装缺少的模块。
pip安装qtconsole
第2步)(如果使用的是pyqt4),请确保在pyinstaller规范文件中排除pyqt5,pyside和pyside2模块。它可能看起来像这样。这在分析部分中
excludes=['pyqtgraph.graphicsItems.PlotItem.plotConfigTemplate_pyqt5',
'pyqtgraph.graphicsItems.PlotItem.plotConfigTemplate_pyqt5',
'pyqtgraph.graphicsItems.ViewBox.axisCtrlTemplate_pyqt5',
'pyqtgraph.GraphicsScene.exportDialogTemplate_pyqt5',
'PyQt5',' PyQt5.QtCore','PyQt5.QtGui','PyQt5.QtPrintSupport',
'PyQt5.QtSvg','PySide','PySide2'],
这可能已经过大了。一旦开始运作,我就不想碰它。优化留给读者练习。
第3步),我将首先告诉您解决方案,然后介绍如何实现。问题是pyinstaller将pyqt4可执行文件放在程序包的顶层。 Qtconsole在PyQt4目录中寻找它们。以下是规范文件的exe部分。
a.binaries + [('PyQt4/QtCore.so','/usr/lib/python2.7/dist-packages
PyQt/QtCore.so','BINARY'), ('PyQt4/QtGui.so','/usr/lib/python2.7/dist-packages
/PyQt4/QtGui.so','BINARY'), ('PyQt4/QtOpenGL.so','/usr/lib/python2.7/dist-packages
/PyQt4/QtOpenGL.so','BINARY'), ('PyQt4/QtSvg.so','/usr/lib/python2.7/dist-packages
/PyQt4/QtSvg.so','BINARY'), ('PyQt4/QtTest.so','/usr/lib/python2.7/dist-packages
/PyQt4/QtTest.so','BINARY'), ('PyQt4/QtXml.so','/usr/lib/python2.7/dist-packages
因此,关于此解决方案的坏处是我们现在收到警告,指出我们在两个地方都有相同的可执行文件。优化留给读者练习。老实说,我还没有弄清楚如何解决这个问题。因此,如果您愿意……很高兴收到您的来信。 这就是步骤3的方式。我认为这部分很重要。我将此添加到我的规格文件中只是为了开发,而不是为了客户的包装。开发该软件包的问题是它无法运行,然后tmp /目录将其自身删除。我看不出是什么问题。我知道我已经安装了pyqt4并且该应用程序是手动运行的。真令人沮丧。因此,如果对您的spec文件执行以下操作,则会得到一个内置目录,而不是可执行文件。该目录保持不变,您可以深入了解内部情况。然后,您武装起来并有危险才能启用该解决方案。然后,当它正常工作时,您将其还原以为客户开发可执行文件。
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='bosetap',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='bosetap')
特别感谢我的老板,我为此坚持了一周。快乐足迹。