今天我尝试安装需要vtk的mayavi。我终于让vtk安装并可导入,但在此过程中破坏了我的python3.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
文件中,但没有任何区别:
下一步是什么?
结果很容易修复。我下载并安装了
qt-opensource-mac-4.8.7.dmg
,这样我的/usr/bin中的qmake是针对qt4.8.7的,然后进入PyQt4_gpl_mac-4.12
并键入python configure.py && make
就成功地完成了。在相关问题 更多 >
编程相关推荐