0

My code starts with installing these packages -


    pip3 install ipython 
    pip3 install selenium  
    pip3 install time 
    pip3 install parsel
    pip3 install csv

but I get -

File "<ipython-input-7-cae965d78112>", line 1
    conda install ipython
                ^
SyntaxError: invalid syntax

I have tried replacing pip3 with pip and conda, it still gives the same error.Please help me to install these packages.

thanks!!!

levis
  • 43
  • 1
  • 8
  • You should write these commands as shell commands, not within an iPython notebook. – zabop Mar 17 '21 at 06:27
  • @zabop you mean to write them in Anaconda prompt? – levis Mar 17 '21 at 06:33
  • If you are on Windows then yes I guess, but I'm not that familiar with Anaconda/Windows. – zabop Mar 17 '21 at 06:39
  • Alternatively, you could try: colab.research.google.com – zabop Mar 17 '21 at 06:40
  • ``` pip3 install csv ERROR: Could not find a version that satisfies the requirement time ERROR: No matching distribution found for time ``` i got this – levis Mar 17 '21 at 06:42
  • use the online python environment then, I recommend. – zabop Mar 17 '21 at 06:46
  • @zabop, is there any way to install the packages in my pc, I wouldn't prefer using online editors. – levis Mar 17 '21 at 06:49
  • Your error is the same as this person's error: https://stackoverflow.com/questions/42522650/cant-install-time-module/46658551, maybe look at that thread. – zabop Mar 17 '21 at 07:16

1 Answers1

0

pip3 and conda are utilities separate to the Python programming language. pip3 and conda make it easier for users to install python packages to their machine/virtual environment which is why you get SyntaxError: invalid syntax because what you've written is not valid Python.

If you want to use pip3 or conda these commands should be used at into a terminal. These tools search online for modules you want to install, download them and install them into the appropriate location (for your user or into your virtual enviroment). If you try to install something that can't be found online in the pypi you'll get an error.

You've tried to install the module csv using pip3 install csv. The csv module is part of Python's standard library so pip3 will not find this package on pypi. Being part of the standard library means that every installation of Python has this library. To use the csv module you can do import csv in your notebook/.py file. The same goes for the module time.

Jason
  • 4,346
  • 10
  • 49
  • 75