ImportError: No module named 'selenium'

后端 未结 18 2145
时光取名叫无心
时光取名叫无心 2020-12-03 00:54

I\'m trying to write a script to check a website. It\'s the first time I\'m using selenium. I\'m trying to run the script on a OSX system. Although I checked in /Library/Pyt

相关标签:
18条回答
  • 2020-12-03 01:09

    first you should be sure that selenium is installed in your system.

    then install pycharm https://itsfoss.com/install-pycharm-ubuntu/

    now if an of packages are not installed it will show red underlines. click on it and install from pycharm.

    like for this case click on selenium option in import statement, there you would getting some options. click on install selenium. it will install and automatically run the code successfully if all your drivers are placed in proper directories.

    0 讨论(0)
  • 2020-12-03 01:11

    If you are using Anaconda or Spyder in windows, install selenium by this code in cmd:

    conda install selenium
    

    If you are using Pycharm IDE in windows, install selenium by this code in cmd:

    pip install selenium
    
    0 讨论(0)
  • 2020-12-03 01:11

    Windows:

    pip install selenium
    

    Unix:

    sudo pip install selenium
    
    0 讨论(0)
  • 2020-12-03 01:14
    pip3 install selenium
    

    Try this if you have python3.

    0 讨论(0)
  • 2020-12-03 01:21

    Even though the egg file may be present, that does not necessarily mean that it is installed. Check out this previous answer for some hint:

    How to install Selenium WebDriver on Mac OS

    0 讨论(0)
  • 2020-12-03 01:22

    Your IDE might be pointing to a different installation of Python than where Selenium is installed.

    I'm using Eclipse and when I ran 'quick auto-configure' under:

    Preferences > PyDev > Interpreters > Python Interpreter

    it pointed to a different version of Python than where pip or easy_install actually installed it.

    Selenium worked from the Terminal so I determined which version of python my Terminal was using by running this:

    python -c "import sys; print(sys.path)"
    

    then had Eclipse point to that same location, which for me on my 10.11 Mac was here:

    /Library/Frameworks/Python.framework/Versions/Current/bin/python2.7/

    You can run "Advanced Auto-Config" as well to see all of the installed versions of python and select the one you want to use. When I selected that same location using "Advanced Auto-Config" it finally showed me the Selenium folder as it went through the configuration steps.

    0 讨论(0)
提交回复
热议问题