8

I am using the Anaconda python distribution and would like to use the selenium package. Unfortunately the distribution does not have selenium included in it so I installed it using the recommended:

pip install -U selenium

the distribution FAQ say this should work fine but when I try to use it I get python telling me it does not know anything about this package.

i.e.

>>> import selenium
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named selenium

I checked and the /usr/local/lib/python2.7/dist-packages directory does have selenium within it. How do I point my python distribution to this so I can use the package?

2
  • 1
    The reason this is happening might be because your Anaconda is pointing to a different python path whereas you are installing the modules in a different python path. That can only be the reason as far as I see, because I just did the same process and it easily imports the selenium package. Commented May 26, 2015 at 5:54
  • conda install -c conda.anaconda.org/metaperl selenium Commented Mar 27, 2016 at 7:19

3 Answers 3

15

Following the advice of a comment in this question I installed Selenium using the pip installed with the distribution.

~/anaconda/bin/pip install -U selenium

I did not know about this before but it seems to have worked.

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

1 Comment

For Windows users, this also works if you run 'pip install -U selenium' inside the 'C:\Users\yourname\Anaconda3' directory with command prompt / power shell.
2

Following works for me:

conda install -c conda-forge selenium

Please check the Selenium page in Anaconda website for details.

Comments

1

Try:

conda install -c metaperl selenium=2.40.0

2 Comments

While this code may answer the question, it would be better to include some context, explaining how it works and when to use it. Code-only answers are not useful in the long run.
This tried to force me to downgrade python 3.7 to 2.7, so be careful!

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.