1

I literally just want to open a web page with python. I think the issue is that Jupyter notebooks is using a different version of python than selenium is being stored in, but I'm not sure how that's possible when I'm installing selenium from Jupyter notebooks. I'll put more details below.

My example code is boring as heck:

from selenium import webdriver

driver = webdriver.chrome()
driver.get('http://python.org')

This of course gives the error in the title. My OS is Linux, distribution is Linux Mint. Terminal says that I have Python 2.7.17, pip is version 9.0.1 (python 2.7).

Trying to install selenium by running

!pip2 install selenium

gives "selenium" and "selenium-3.141.0 dist-info" folders in the path /home/frogsnakeman/.local/lib/python2.7/site-packages (my user is frogsnakeman :P )

However, the input

from platform import python_version
print(python_version())

returns 3.6.9.

Aidan Murphy
  • 121
  • 5
  • `webdriver.chrome()` should be `webdriver.Chrome()` – NarendraR May 20 '20 at 05:54
  • @NarendraR it didn't work even when it had the capital Chrome; I had changed it to lower case because the folder was lower case in the webdriver folder. – Aidan Murphy May 20 '20 at 14:03
  • My question was closed with a reference to https://stackoverflow.com/questions/48267633/python-no-module-named-selenium, which did not work when I tried it at the *very beginning* of this process (using pip inside jupyter was not my first go-to). I didn't have a path to the geckodriver, but I don't think that would affect whether or not selenium is found in general. This is the second time my post has been closed with reference to an ultra generic answer, so I'm quitting for now. – Aidan Murphy May 20 '20 at 14:17

1 Answers1

0

To check your installed libs you can use pip freeze;

To check if you have more than two versions of python you can use wich pythonand after type tab all available versions will appear for you.

  • I didn't know about `which python`, so thanks for that! :) I've got a bunch of versions of python shown by `which python`; my question is more specifically how installing selenium from Jupyter nb would not affect the version of python that Jupyter is using. (reasonably, that's confusing to me :P ) – Aidan Murphy May 20 '20 at 14:28
  • I think your awnsere could be here. https://docs.python-guide.org/dev/virtualenvs/ Creating a virtual env with the dependencies that you need without affect other python's versions. – Joao Henrique Ferreira May 20 '20 at 16:28