This blog was created as a storehouse for the random bits of information that I am always trying to pack away and recover later. Mostly it is intended to hold the simple recipes and instructions for doing basic tasks that I can never remember, don't want to look up again, and would like to have available. If you find the information useful, that's great. If you feel the need to comment, correct, or augment the info--even better!
Wednesday, February 24, 2016
Running Python pip on a specific python installation
Python versions are a bit confused on my Ubuntu install right now. If I type "python" at the command line I get Python 2.7. If I type python3 then I get Python 3.4. And python3.5 gives me Python 3.5. Not usually a problem because I put the correct entry in the shebang of the script I am running, but it is sometimes difficult to get pip to install in the right place (or, I should say, to figure out where pip installed and determine if it is where I want it, because who knows what the "right" place is?).
So to ensure that something installs in the correct place, instead of typing
pip install paho-mqtt
python3.5 -m pip install paho-mqtt
and it will install in the specific Python version you indicated (in this case, python3.5).