Installing matplotlib on Ubuntu 14.04 after installing Python 3 with pyenv
I dont have Ubuntu system right now with me. but still I can help you I think.
open your terminal and type as
apt-cache search python3-matplotlib
If you find it like its available then you can install it from
sudo apt-get install python3-matplotlib
that is the most preferred way.
Now how to use matplotlib with python 3. I have posted a question also in here about how to use python2 and python3 side by side.
Simple , use python3 <filename.py>
while executing your program with python3-matplotlib
and similarly if you use python2 then it will load python 2.
hope that helps.
Related videos on Youtube
Håkon Hægland
Updated on September 18, 2022Comments
-
Håkon Hægland over 1 year
I am using Ubuntu 14.04 with Python 2.7.6. I have installed
matplotlib
for Python 2. Now, I just installed Python 3.4.2 usingpyenv install 3.4.2
. I then ranpip install matplotlib
to installmatplotlib
for Python 3. I later discovered the packagepython3-matplotlib
for Ubuntu 14.04. I wonder: should I have usedsudo apt-get install python3-matplotlib
instead? What is the preferred way of installingmatplotlib
for Python 3 side-by- side with the Python 2matplotlib
? -
Håkon Hægland over 9 yearsThanks, the package is available. Should I try uninstall the
pip
installation, that is:pip uninstall matplotlib
, and then runsudo apt-get install python3-matplotlib
? -
mx7 over 9 yearsNo need, you can continue.
-
Håkon Hægland over 9 yearsRegarding how to run it: Or I could run
pyenv global 3.4.2
and then justpython <filename.py>
? -
mx7 over 9 years1st one is okay but 2nd one you have to use python3 <filename.py> so it load python3 modules
-
mx7 over 9 yearssome libraries may available in both with same behavior but not very time. Good luck.
-
gravity almost 8 yearsAdditional information, such as what commands to run in Terminal, or through the GUI, would be very useful for the OP to understand what needs to be done.