0
votes

I'm trying to run a script given on a website to scrape hockey data for my first personal project (I'm new to programming and want to start my own project). It requires me to install python 3 and anaconda. After troubleshooting and installing it, I've gotten all the prerequisites install to run the script.

the way it should work is in terminal, from my understanding, you should be able to run "import hockey_scraper". Command not found.

First search shows me to use #!/usr/bin/env python3

 % #!/usr/bin/env python3 import hockey_scraper

Now I get "zsh: event not found: /usr/bin/env"

Second search shows me bash, and possibly zsh do not see ! and has to be in double quotes.

 % '#!/usr/bin/env python' > import hockey_scraper

zsh: no such file or directory: #!/usr/bin/env python

Now I'm confused on what I need to do, because I have python2.7 and 3.x installed, I can see both in python -V and python3 -V.

edit:

what I'm trying to use https://hockey-scraper.readthedocs.io/en/latest/#

3

3 Answers

2
votes

If you have both Python versions installed, then there is a chance that you have installed hockey-scraper under Python 2, what command did you use to install hockey-scraper? You should try to use pip3 install hockey-scraper

Secondly, where are you running import hockey-scraper? It should be in your Python script not executed in the terminal.

2
votes

You're mixing up shell commands and python code.

#!/usr/bin/env python3 is a line you would put at the top of a shell script. But you're not doing that; you just want to run python. So just type python3 at the command prompt.

Then, once you're in the python shell, you can begin typing python code, such as import hockey_scraper.

0
votes

Inside the terminal, you have to run "pip install hockey_scraper". However, once you've done that the "import hockey_scraper" command goes at the top of your python script. Not inside the terminal.

Once you've written your finished python file containing "import hockey_scraper" at the top, go inside the terminal and navigate to your python file. Then do "python3 (nameOfFile).py".

-Aron