Install pyqt via homebrew with `--with-python3` but still goes to Python 2

依然范特西╮ 提交于 2019-12-25 02:43:34

问题


Here's my command and output (some command line arguments are left out). What is going wrong? Thank you.

$ brew reinstall pyqt --with-python3
==> Reinstalling pyqt --with-python3
==> Downloading http://downloads.sf.net/project/pyqt/PyQt4/PyQt-4.10.3/PyQt-mac-
Already downloaded: /Library/Caches/Homebrew/pyqt-4.10.3.tar.gz
==> Patching
patching file configure.py
==> python configure.py --confirm-license --bindir=/usr/local/Cellar/pyqt/4.10.3
==> python ./configure-ng.py --confirm-license --bindir=/usr/local/Cellar/pyqt/4
==> make
==> make install
==> Caveats
Set PYTHONPATH if you want Python to find your site-packages:
  export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
==> Summary
🍺  /usr/local/Cellar/pyqt/4.10.3: 560 files, 18M, built in 6.6 minutes

UPDATE: I think the formula of pyqt somehow hard-codes the python's version. For example it explicitly includes paths like python2.7/site-packages/. Here's part of the file:

  def install
    # On Mavericks we want to target libc++, this requires a non default qt makespec
    if ENV.compiler == :clang and MacOS.version >= :mavericks
      ENV.append "QMAKESPEC", "unsupported/macx-clang-libc++"
    end

    args = [ "--confirm-license",
             "--bindir=#{bin}",
             "--destdir=#{lib}/python2.7/site-packages",
             "--sipdir=#{share}/sip" ]
    # We need to run "configure.py" so that pyqtconfig.py is generated, which
    # is needed by PyQWT (and many other PyQt interoperable implementations such
    # as the ROS GUI libs). This file is currently needed for generating build
    # files appropriate for the qmake spec that was used to build Qt. This method
    # is deprecated and will be removed with SIP v5, so we do the actual compile
    # using the newer configure-ng.py as recommended.
    system "python", "configure.py", *args
    (lib/'python2.7/site-packages').install 'pyqtconfig.py'

    # On Mavericks we want to target libc++, this requires a non default qt makespec
    if ENV.compiler == :clang and MacOS.version >= :mavericks
      args << "--spec" << "unsupported/macx-clang-libc++"
    end

    system "python", "./configure-ng.py", *args
    system "make"
    system "make", "install"
  end

回答1:


You should check out this issue on Homebrew's git: https://github.com/Homebrew/homebrew/issues/25735

We can no longer use the --with-python3 argument with pyside/pyqt/sip. Unfortunately, it seems like we can't use Homebrew for these modules in a while. They probably have to find another solution of handling the formulas for having Python 2.7 and Python3 installs first.

I scratched my head for days figuring this out. Ended up with installing PyQt from source.

Good luck.



来源:https://stackoverflow.com/questions/20956517/install-pyqt-via-homebrew-with-with-python3-but-still-goes-to-python-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!