0

I have some problems with my computer. Temporarily, I will have to boot ubuntu from a USB drive (trying version without installing) until I repair my computer. How must I define the path so I am able to run python scripts with matplotlib? I tried to define PYTHONPATH=${PYTHONPATH}:/usr/lib/python3.5 then I also add python3 and python2.7. But I got some errors from the folder python 3.5

File "/usr/lib/python3.5/site.py", line 182
file=sys.stderr)
SyntaxError : invalid syntax

Any idea? thank you!

4
  • 1
    Have you actually mounted the original system device? Probably the simplest thing would be to install the relevant matplotlib package(s) (python-matplotlib or python3-matplotlib) within the USB live system May 15, 2017 at 1:00
  • Also, have you tried simply running /usr/bin/python3 without setting the PYTHONPATH? If it fails, what error do you get?
    – MiniQuark
    May 15, 2017 at 11:45
  • steeldriver : I didn't exactly mount it, but the computer see my hard disk on which is my home but not my SSD disk(where are the booting files...). This is why I boot from a USB key and installing linux on my computer is pretty hard. I can't use the usual interface without having kernel problems. I did it once before. I had to change manually a few options before installing, but I will install only once I resolve my SSD disk problem. I will try to install it again later. It did not work well last time I tried.
    – Marie
    May 15, 2017 at 14:13
  • MiniQuark : It does not work. ImportError: No module named 'matplotlib'
    – Marie
    May 15, 2017 at 14:14

1 Answer 1

0

Getting a SyntaxError on that particular line certainly means that you are running Python 2 instead of Python 3 (since this is valid Python 3 syntax, but invalid Python 2).

Make sure that you are running the python3 command rather than python.

Edit

Regarding the matplotlib loading issue, Python looks for dynamic linked libraries using paths listed in LD_LIBRARY_PATH. Make sure LD_LIBRARY_PATH includes /usr/local/lib, and try again.

2
  • I tried but it did not work. It can't find matplotlib.
    – Marie
    May 15, 2017 at 14:15
  • It must be looking for the system libraries, I'm guessing you need to give it the paths to the dynamic libraries. Please provide the error messages, otherwise it's hard to help you.
    – MiniQuark
    May 15, 2017 at 15:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .