简体   繁体   中英

Syntax error while trying to download selenium using pip on python 3.8.2

File "main.py", line 2 python38 -m pip install selenium ^ SyntaxError: invalid syntax  This error comes up when I try to run my code. I am using python on replit and have already imported pip on a previous line. Can anyone give me suggestions on what is wrong here?

I used selenium on replit a few months ago and it does work, but it's not the smoothest experience (especially when you have a free tier).

Installing selenium on replit :

  1. You can install it by running python -m pip install selenium in shell (next to console)
  2. Make requirements.txt file, paste all required modules there and use this code with os.system method (which you can use to execute commands):
import os
os.system("python -m pip install -r requirements.txt")
  1. When you import selenium at the beginning in replit it should automatically download it, but if it doesn't then:
os.system("python -m pip install selenium")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM