Click here to Skip to main content
15,070,224 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am trying to run python code from github I found, however I have installed all requirements and after I run .py file it throw error:
Python
ImportError: No module named selenium


I have in my C:\python 36 and python 27 and python 38
could it be this because I have more version?

What I have tried:

My code:
#!/usr/bin/env python
import time
import argparse
from selenium import webdriver
from random import randint

import sys


after a test of install it return ok:
C:\Users\work>pip3 install selenium
Requirement already satisfied: selenium in c:\python36\lib\site-packages (3.141.0)
Requirement already satisfied: urllib3 in c:\python36\lib\site-packages (from selenium) (1.25.8)
Posted
Updated 7-Apr-20 0:02am
Comments
Richard MacCutchan 27-Feb-20 7:55am
   
Are you using python36 to run this script?
[no name] 27-Feb-20 8:19am
   
I have now uninstall all python versions and installed 3.8.2 and I will check will answer shortly thx
[no name] 27-Feb-20 8:25am
   
Now all modules ok but it wont lunch as it shows: SyntaxError: unexpected character after line continuation character
:-(
Richard MacCutchan 27-Feb-20 8:34am
   
Where?
[no name] 27-Feb-20 8:37am
   
I have also another issue now: ERROR: Could not find a version that satisfies the requirement queue (from versions: none)
Is it really a module? Why cant it be found? "Queque"
Richard MacCutchan 27-Feb-20 9:09am
   
Sorry, no idea. However, it may be that your entire installation is somehow corrupted. Maybe time to try and reinstall everything from scratch.

1 solution

Importing selenium works without any issue in Python 2x but you'll see error while working in Python 3x. I'm guessing since you have both Python 2 and 3 both installed, it checks for selenium installation while running installation test and returns ok because of version 2.

I would suggest you to uninstall all python environments and then only install python 3.
For selenium download the package from [^]selenium-3.141.0.tar.gz, unpack and install manually.
For your reference, You can extract the file using these commands.
Python
cd directory_containing_selenium-3.141.0.tar.gz
tar -xvzf selenium-3.141.0.tar.gz 

and install it.
Python
python setup.py install

This should solve your problem.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900