0

I installed selenium and verified installation

User-MacBook-Pro:webscrape user$ sudo pip3 install selenium

The directory '/Users/user/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/Users/user/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Requirement already satisfied: selenium in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (3.14.1) Requirement already satisfied: urllib3 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from selenium) (1.23)

then I tried to run a simple python file and I got this

  User-MacBook-Pro:webscrape user$ python vendorscrape.py 

Traceback (most recent call last): File "vendorscrape.py", line 1, in from selenium import webdriver ImportError: No module named selenium

this is the python script vendorscrape.py

 from selenium import webdriver
 from selenium.webdriver.common.keys import Keys
 from bs4 import BeautifulSoup
 import re
 import pandas as pd
 import os



 print("we are on")
3
  • 1
    Have you tried running your file with python3 as opposed to python? Commented Sep 22, 2018 at 0:09
  • 1
    you are right @scales Commented Sep 22, 2018 at 0:14
  • Why are you using sudo? I suggest you do pip install instead. Commented Sep 22, 2018 at 0:27

2 Answers 2

2

I used python3 instead of python

Sign up to request clarification or add additional context in comments.

Comments

1

First, you should install the package as your current user (without sudo):

pip3 install selenium

Second, you should use matching version for pip and python commands. Either use pip with python or pip3 with python3.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.