shejibri's blog

By shejibri, 4 years ago, In English

How can I use Visualizer on my PC? When I just ran given python code(vis.py in line.zip), I had syntax error. There is a link: https://oj.uz/problem/view/IOI19_line

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

You have to run it in Python 3:

pip3 install matplotlib

python3 vis.py [ARGS]

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I ran it in Python 3.9.1(64bit). Should this work?

    I had a syntax error because of "pip3 install matplotlib".

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I think you misunderstood something. pip is Python's package installer, so you should be able to use it in the terminal (cmd in windows) if it's installed correctly. Type pip3 install matplotlib in your terminal, not in your code file. If that says something like pip3 not found, try just pip install matplotlib. Since you are getting syntax error, python3 command probably works. So after installing the matplotlib package, just run the code with python3 vis.py [args] (note that this command should be run in the same directory as vis.py).

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        cmd says: "'pip3' is not recognized as an internal or external command, operable program or batch file."

        I tried "pip install matplotlib" also, but it said the same thing.

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Interesting, since pip should already ship with python. Try python3 -m pip install and repeat the process. If it complains about python3 (windows usually uses python) try just python.