CMake发现错误版本的python

时间:2018-04-12 05:37:51

标签: python cmake homebrew pythoninterpreter

如何解决以下错误:

CMake Error at /usr/local/Cellar/cmake/3.11.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find PythonInterp: Found unsuitable version "1.4", but required
  is at least "3" (found /usr/local/bin/python3)

其中CMake发现错误版本的python。

如何解决这个问题,如

python --version
Python 2.7.14

geoheil@eduroam-078-104-029-050 ~                                                                                           [17:34:02]
> $ python3 --version
Python 3.6.5

已经返回通过home-brew安装的正确版本的python?

修改

这里有一些澄清: - cmake也是通过自制啤酒安装的

which python
/usr/local/bin/python

geoheil@geoheils-MacBook ~                                                                                                   [8:01:12]
> $ which python2
/usr/local/bin/python2

geoheil@geoheils-MacBook ~                                                                                                   [8:01:15]
> $ which python3
/usr/local/bin/python3

geoheil@geoheils-MacBook ~                                                                                                   [8:01:18]
> $ echo $PATH
/Users/geoheil/development/flutter/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/bin:/Library/oracle/instantclient_12_1

编辑2

更多澄清

> $ which make
/usr/bin/make

geoheil@geoheils-MacBook ~                                                                                                  [11:20:25]
> $ which cmake
/usr/local/bin/cmake

geoheil@geoheils-MacBook ~                                                                                                  [11:20:27]
    > $ ls -l /usr/local/bin/make
    ls: /usr/local/bin/make: No such file or directory
ls /usr/local/bin |grep make
automake
automake-1.16
ccmake
cmake
cmakexbuild

详细的堆栈tracke

CMake Error at /usr/local/Cellar/cmake/3.11.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find PythonInterp: Found unsuitable version "1.4", but required
  is at least "3" (found /usr/local/bin/python3)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.11.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:376 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.11.0/share/cmake/Modules/FindPythonInterp.cmake:155 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:696 (FIND_PACKAGE)

brew医生输出

brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: A newer Command Line Tools release is available.
Update them from Software Update in the App Store.


Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libnnz11.dylib
  /usr/local/lib/libociei.dylib
  /usr/local/lib/libocijdbc11.dylib

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  docker-machine
  ghostscript
  numpy
  gprof2dot
  grass7
  matplotlib
  gnupg
  ruby

Warning: Broken symlinks were found. Remove them with `brew prune`:
  /usr/local/bin/docker-credential-osxkeychain.backup
  /usr/local/bin/hyperkit.backup
  /usr/local/bin/notary.backup
  /usr/local/bin/vpnkit.backup
  /usr/local/lib/qt-4/plugins/designer/libqscintillaplugin.dylib
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/Qsci.pyi
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/Qsci.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/Qt.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtCore.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtDeclarative.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtDesigner.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtGui.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtHelp.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtMultimedia.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtNetwork.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtOpenGL.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtScript.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtScriptTools.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtSql.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtSvg.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtTest.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtWebKit.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtXml.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/QtXmlPatterns.so
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/__init__.py
  /usr/local/lib/qt-4/python2.7/site-packages/PyQt4/pyqtconfig.py
  /usr/local/lib/qt-4/python2.7/site-packages/sip.pyi
  /usr/local/lib/qt-4/python2.7/site-packages/sip.so
  /usr/local/lib/qt-4/python2.7/site-packages/sipconfig.py
  /usr/local/lib/qt-4/python2.7/site-packages/sipdistutils.py

geoheil@geoheils-MacBook ~                                                                                                   [1:52:27]
> $

重现执行:

brew install -v --no-sandbox qgis/qgisdev/qgis3-dev --with-grass --with-r

确切的堆栈跟踪是:

==> cmake -G Ninja -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/qgis3-dev/3.0.1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH=/usr/local/opt/qt;/usr/local/opt/qt5-webkit;/usr/local/opt/qscintilla2;/usr/local/opt/qwt;/usr/local/opt/qwtpolar;/usr/local/opt/qca;/usr/local/opt/gdal2;/usr/local/opt/gsl;/usr/local/opt/geos;/usr/local/opt/proj;/usr/local/opt/libspatialite;/usr/local/opt/spatialindex;/usr/local/opt/expat;/usr/local/opt/sqlite;/usr/local/opt/libzip;/usr/local/opt/flex;/usr/local/opt/bison;/usr/local/opt/fcgi -DENABLE_TESTS=FALSE -DENABLE_MODELTEST=FALSE -DQGIS_MACAPP_BUNDLE=0 -DQGIS_MACAPP_INSTALL_DEV=FALSE -DWITH_QWTPOLAR=TRUE -DWITH_INTERNAL_QWTPOLAR=FALSE -DWITH_ASTYLE=FALSE -DWITH_QSCIAPI=TRUE -DWITH_STAGED_PLUGINS=TRUE -DWITH_GRASS=FALSE -DWITH_CUSTOM_WIDGETS=TRUE -DWITH_QTWEBKIT=TRUE -DGDAL_LIBRARY=/usr/local/opt/gdal2/lib/libgdal.dylib -DGEOS_LIBRARY=/usr/local/opt/geos/lib/libgeos_c.dylib -DGSL_CONFIG=/usr/local/opt/gsl/bin/gsl-config -DGSL_INCLUDE_DIR=/usr/local/opt/gsl/include -DGSL_LIBRARIES='-L/usr/local/opt/gsl/lib -lgsl -lgslcblas' -DWITH_SERVER=TRUE -DPOSTGRES_CONFIG=/usr/local/opt/postgresql/bin/pg_config -DWITH_GRASS7=TRUE -DGRASS_PREFIX7='/usr/local/opt/grass7/grass-base' -DWITH_GLOBE=FALSE -DWITH_ORACLE=FALSE -DWITH_QSPATIALITE=FALSE -DWITH_APIDOC=FALSE -DWITH_3D=FALSE -DCLANG_TIDY_EXE= ..
-- The C compiler identification is AppleClang 9.1.0.9020039
-- The CXX compiler identification is AppleClang 9.1.0.9020039
-- Check for working C compiler: /usr/local/Homebrew/Library/Homebrew/shims/super/clang
-- Check for working C compiler: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/Homebrew/Library/Homebrew/shims/super/clang++
-- Check for working CXX compiler: /usr/local/Homebrew/Library/Homebrew/shims/super/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- QGIS version: 3.1.0 Master (30100)
-- Found GRASS 7: /usr/local/opt/grass7/grass-base (7.2.2, off_t size = )
-- Looking for openpty
-- Looking for openpty - found
-- Looking for proj_info in /usr/local/opt/proj/lib/libproj.dylib
-- Looking for proj_info in /usr/local/opt/proj/lib/libproj.dylib - found
-- Found Proj: /usr/local/opt/proj/lib/libproj.dylib
-- Found GEOS: /usr/local/opt/geos/lib/libgeos_c.dylib (3.6.2)
-- Found GDAL: /usr/local/opt/gdal2/lib/libgdal.dylib (2.2.4)
-- Found Expat: /usr/local/opt/expat/lib/libexpat.dylib
-- Found Spatialindex: /usr/local/opt/spatialindex/lib/libspatialindex.dylib
-- Found Qwt: /usr/local/opt/qwt/lib/qwt.framework (6.1.3)
-- Found libzip: /usr/local/opt/libzip/lib/libzip.dylib
-- Found Sqlite3: /usr/local/opt/sqlite/lib/libsqlite3.dylib
-- Found PostgreSQL: /usr/local/lib/libpq.dylib
-- Found SpatiaLite: /usr/local/opt/libspatialite/lib/libspatialite.dylib
-- Looking for gaiaStatisticsInvalidate in /usr/local/opt/libspatialite/lib/libspatialite.dylib
-- Looking for gaiaStatisticsInvalidate in /usr/local/opt/libspatialite/lib/libspatialite.dylib - found
-- Qt WebKit support enabled
-- Found Qt version: 5.10.1
-- Found QScintilla2: /usr/local/opt/qscintilla2/lib/libqscintilla2_qt5.dylib (2.10.4)
-- Found QtKeychain: /usr/local/lib/libqt5keychain.dylib
-- Found QCA: /usr/local/opt/qca/lib/qca-qt5.framework (2.1.3)
-- QtCore/QCA include/lib variables missing or CMake is cross-compiling,
--   skipping QCA OpenSSL plugin C++ check
-- Found Libtasn1: /usr/local/include
-- Pedantic compiler settings enabled
-- Debug output enabled
CMake Error at /usr/local/Cellar/cmake/3.11.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find PythonInterp: Found unsuitable version "1.4", but required
  is at least "3" (found /usr/local/bin/python3)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.11.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:376 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.11.1/share/cmake/Modules/FindPythonInterp.cmake:155 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:696 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!
See also "/tmp/qgis3-dev-20180420-31869-62l4n4/build/CMakeFiles/CMakeOutput.log".

==> Formula
Tap: qgis/qgisdev
Path: /usr/local/Homebrew/Library/Taps/qgis/homebrew-qgisdev/Formula/qgis3-dev.rb
==> Configuration
HOMEBREW_VERSION: 1.6.1
ORIGIN: https://github.com/Homebrew/brew
HEAD: 5a2817cb023ca5e929fe030d423002992bdabf1b
Last commit: 4 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: a2db529ab071d34fe50dbb6b104fa04a85c39fbf
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_ENABLE_AUTO_UPDATE_MIGRATION: 1
CPU: octa-core 64-bit kabylake
Homebrew Ruby: 2.3.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: 9.1 build 902
Git: 2.17.0 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 10, 1.8.0_162, 1.8.0_131
macOS: 10.13.4-x86_64
CLT: N/A
Xcode: 9.3
XQuartz: 2.7.11 => /opt/X11
==> ENV
HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
CXXFLAGS: -isystem /usr/local/Cellar/grass7/7.2.2/grass-base/include
SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
MAKEFLAGS: -j8
CMAKE_PREFIX_PATH: /usr/local/opt/bison:/usr/local/opt/flex:/usr/local/opt/openssl:/usr/local/opt/readline:/usr/local/opt/sqlite:/usr/local/opt/qt:/usr/local/opt/qt5-webkit:/usr/local/opt/expat:/usr/local/opt/libxml2:/usr/local/opt/gdal2:/usr/local/opt/gdal2-python:/usr/local/opt/gettext:/usr/local/opt/libffi:/usr/local/opt/openblas:/usr/local
CMAKE_INCLUDE_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/apache2:/opt/X11/include:/opt/X11/include/freetype2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /opt/X11/lib:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
CMAKE_FRAMEWORK_PATH: /usr/local/opt/python/Frameworks:/usr/local/opt/qt/Frameworks:/usr/local/opt/qt5-webkit/Frameworks:/usr/local/opt/python@2/Frameworks:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/sqlite/lib/pkgconfig:/usr/local/opt/xz/lib/pkgconfig:/usr/local/opt/python/lib/pkgconfig:/usr/local/opt/qt/lib/pkgconfig:/usr/local/opt/qt5-webkit/lib/pkgconfig:/usr/local/opt/python@2/lib/pkgconfig:/usr/local/opt/qca/lib/pkgconfig:/usr/local/opt/gsl/lib/pkgconfig:/usr/local/opt/expat/lib/pkgconfig:/usr/local/opt/proj/lib/pkgconfig:/usr/local/opt/spatialindex/lib/pkgconfig:/usr/local/opt/libpng/lib/pkgconfig:/usr/local/opt/freetype/lib/pkgconfig:/usr/local/opt/postgresql/lib/pkgconfig:/usr/local/opt/libzip/lib/pkgconfig:/usr/local/opt/libtasn1/lib/pkgconfig:/usr/local/opt/jpeg/lib/pkgconfig:/usr/local/opt/libtiff/lib/pkgconfig:/usr/local/opt/json-c/lib/pkgconfig:/usr/local/opt/pcre/lib/pkgconfig:/usr/local/opt/freexl/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/libspatialite/lib/pkgconfig:/usr/local/opt/gdal2/lib/pkgconfig:/usr/local/opt/unixodbc/lib/pkgconfig:/usr/local/opt/mpfr/lib/pkgconfig:/usr/local/opt/isl/lib/pkgconfig:/usr/local/opt/fftw/lib/pkgconfig:/usr/local/opt/fontconfig/lib/pkgconfig:/usr/local/opt/pixman/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/glib/lib/pkgconfig:/usr/local/opt/cairo/lib/pkgconfig:/usr/local/opt/little-cms2/lib/pkgconfig:/usr/local/opt/openblas/lib/pkgconfig:/usr/local/opt/r/lib/pkgconfig
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.13:/opt/X11/lib/pkgconfig:/opt/X11/share/pkgconfig
HOMEBREW_SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
ACLOCAL_PATH: /usr/local/opt/bison/share/aclocal:/usr/local/opt/libxml2/share/aclocal:/usr/local/opt/gettext/share/aclocal:/usr/local/share/aclocal:/opt/X11/share/aclocal
PATH: /usr/local/Cellar/qgis3-dev/3.0.1/libexec/python/bin:/usr/local/Homebrew/Library/Homebrew/shims/super:/usr/local/opt/cmake/bin:/usr/local/opt/ninja/bin:/usr/local/opt/bison/bin:/usr/local/opt/flex/bin:/usr/local/opt/gdbm/bin:/usr/local/opt/openssl/bin:/usr/local/opt/sqlite/bin:/usr/local/opt/xz/bin:/usr/local/opt/python/bin:/usr/local/opt/qt/bin:/usr/local/opt/python@2/bin:/usr/local/opt/sip/bin:/usr/local/opt/pyqt/bin:/usr/local/opt/qca/bin:/usr/local/opt/gsl/bin:/usr/local/opt/expat/bin:/usr/local/opt/proj/bin:/usr/local/opt/libpng/bin:/usr/local/opt/freetype/bin:/usr/local/opt/numpy/bin:/usr/local/opt/fcgi/bin:/usr/local/opt/postgresql/bin:/usr/local/opt/libzip/bin:/usr/local/opt/libtasn1/bin:/usr/local/opt/jpeg/bin:/usr/local/opt/giflib/bin:/usr/local/opt/libtiff/bin:/usr/local/opt/libgeotiff/bin:/usr/local/opt/geos/bin:/usr/local/opt/pcre/bin:/usr/local/opt/libxml2/bin:/usr/local/opt/gdal2/bin:/usr/local/opt/gdal2-python/bin:/usr/local/opt/gettext/bin:/usr/local/opt/lbzip2/bin:/usr/local/opt/libtool/bin:/usr/local/opt/unixodbc/bin:/usr/local/opt/gcc/bin:/usr/local/opt/fftw/bin:/usr/local/opt/wxmac/bin:/usr/local/opt/fontconfig/bin:/usr/local/opt/glib/bin:/usr/local/opt/cairo/bin:/usr/local/opt/little-cms2/bin:/usr/local/opt/ghostscript/bin:/usr/local/opt/grass7/bin:/usr/local/opt/r/bin:/opt/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin

Error: qgis/qgisdev/qgis3-dev 3.0.1 did not build

哪个cmake 的/ usr / local / bin中/ cmake的

0 个答案:

没有答案