Here's my problem. I can't install MatPlotLib both via pip
and from source (Matplotlib installation on Mavericks). I tried brew install matplotlib
and the installation successfully ended. However, it installed MatPlotLib globally and not inside the currently activated VirtualEnv.
Is it possible to tell brew to install a package inside the current VirtualEnv?
All that a virtual environment does is change what Python interpreter will be invoked by modifying the PATH
variable. Homebrew doesn't look at that because it doesn't use Python to install packages (like pip
does). By design, as Tim said, Homebrew installs inside its own prefix every time.
One could conceive of a modified Python virtual environment that also installs its own copy of Homebrew, but that would be almost entirely a bad thing.
What you can do, if you want Homebrew packages in a virtual environment, is to enable system site packages in the venv (in Python3, this would be python3 -m venv --system-site-packages ~/path/to/venv
). This can be done to update existing virtual environments, as well.
Enabling system site packages allows Python to use globally installed packages, but it will still search inside the venv first, and you can override global packages by installing something with pip
. As far as I can tell, this is as close as you'll get to The Right Way in that situation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With