Ongoing Adventures In Hobby Developers Doing Professional Development
(macOS Sierra Edition)
So the fun of package managers that are not baked into the operating system is that they like putting things in their own little world. Because Homebrew bottled its own Python3, it knew where to put PyQt5 (and yes, it's 5). Because Apple's Xcode installed its own version of Python2, then Homebrew didn't clobber Apple's installation.
$ cd /usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
$ ls
PyQt5 pkg_resources sipconfig.py
__pycache__ setuptools sipdistutils.py
easy_install.py setuptools-32.2.0-py3.6.egg-info sitecustomize.py
pip sip.pyi wheel
pip-9.0.1-py3.6.egg-info sip.so wheel-0.29.0-py3.6.egg-info
Yup, there it is. But there is pip
, too, so if I try to use pip to install PyQt it will just go into the Python3 repository.
So let's ignore Xcode and install our own Python 2:
==> Caveats
Pip and setuptools have been installed. To update them
pip install
You can install Python packages with
pip install <package>
They will install into the site-package directory
/usr/local/lib/python2.7/site-packages
See: http://docs.brew.sh/Homebrew-and-Python.html
This says something disturbing...
site-packages and the PYTHONPATH
The site-packages is a directory that contains Python modules (especially bindings installed by other formulae). Homebrew creates it here:
$(brew --prefix)/lib/pythonX.Y/site-packages
So, for Python 2.7.x, you’ll find it at /usr/local/lib/python2.7/site-packages.
Cool!
$ cd /usr/local/lib/python2.7/site-packages
$ pwd
/usr/local/lib/python2.7/site-packages
$ ls
appdirs-1.4.3.dist-info pip setuptools-35.0.2.dist-info six-1.10.0.dist-info
appdirs.py pip-9.0.1-py2.7.egg-info sip.pyi six.py
appdirs.pyc pkg_resources sip.so six.pyc
easy_install.py pyparsing-2.2.0.dist-info sipconfig.py wheel
easy_install.pyc pyparsing.py sipdistutils.py wheel-0.29.0-py2.7.egg-info
packaging pyparsing.pyc sitecustomize.py
packaging-16.8.dist-info setuptools sitecustomize.pyc
Where the hell is PyQt? Maybe if I run it from the Homebrew install location:
$ cd /usr/local/Cellar/python/2.7.13/bin
$ ./pip install pyqt4
Collecting pyqt4
Could not find a version that satisfies the requirement pyqt4 (from versions: )
No matching distribution found for pyqt4
$ ./pip search pyqt4
[...]
PyQt4 (4.11.4) - Python bindings for the Qt cross platform GUI toolkit
Not sure what to do at this point. Will continue to prod and grind.