无法使用Python 3.6在OS X 10.10.5 Yosemite中安装PyQt4

时间:2017-01-21 08:54:02

标签: python qt pyqt

今天我尝试安装需要vtk的mayavi。我终于得到vtk安装并可导入但在此过程中破坏了我的Python 3.4环境。现在是时候我移动到3.6了,所以这不是一个大问题,但是一个巨大的问题是现在无法安装PyQt4。

我得到Qt(5.7.1)和SIP(4.19)只有一点麻烦,但我遇到了PyQt4的障碍。我已尝试过两个brew install pyqt并尝试从源代码构建它。在这两种情况下,结果如下:

Determining the layout of your Qt installation...
/usr/local/opt/qt5/bin/qmake -spec macx-g++ -o qtdirs.mk qtdirs.pro
make -f qtdirs.mk
/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -c -pipe -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.8 -O2-std=gnu++11 -Wall -W -fPIC -DQT_NO_DEBUG -DQT_CORE_LIB -I. -I/usr/local/Cellar/qt5/5.7.1_1/lib/QtCore.framework/Headers -I. -I/usr/local/Cellar/qt5/5.7.1_1/mkspecs/macx-g++ -F/usr/local/Cellar/qt5/5.7.1_1/lib -o qtdirs.o qtdirs.cpp
In file included from qtdirs.cpp:1:
In file included from /usr/local/Cellar/qt5/5.7.1_1/lib/QtCore.framework/Headers/QCoreApplication:1:
In file included from /usr/local/Cellar/qt5/5.7.1_1/lib/QtCore.framework/Headers/qcoreapplication.h:43:
In file included from /usr/local/Cellar/qt5/5.7.1_1/lib/QtCore.framework/Headers/qglobal.h:1145:
In file included from /usr/local/Cellar/qt5/5.7.1_1/lib/QtCore.framework/Headers/qatomic.h:46:
/usr/local/Cellar/qt5/5.7.1_1/lib/QtCore.framework/Headers/qbasicatomic.h:61:4: error: "Qt requires C++11 support"
#  error "Qt requires C++11 support"
   ^

作为回应,我尝试了export CXXFLAGS=-std=c++11和({单独和一起} export CPPFLAGS=-std=c++11但没有帮助。我还尝试将以下内容添加到qtdirs.pro文件中,但没有区别:

QMAKE_LFLAGS += -stdlib=libc++
QMAKE_CXXFLAGS += -stdlib=libc++
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CXXFLAGS += -mmacosx-version-min=10.7
QMAKE_LFLAGS += -mmacosx-version-min=10.7

下一步是什么?

1 个答案:

答案 0 :(得分:0)

事实证明,修复非常简单。我下载并安装了 "filters": [ { "script": { "script": "doc['f'].values.length == 3" } }, { "terms": { "f": [ 1, 3, 6 ], "execution": "and" } } ] ,以便我/ usr / bin中的qmake用于Qt 4.8.7,然后只需进入qt-opensource-mac-4.8.7.dmg并输入PyQt4_gpl_mac-4.12成功完成。