PhantomJS was put in the path and can be executed in the terminal, but the PATH error in Python

Note: PhantomJS runs in PyCharm, but not IDLE

I have successfully used PhantomJS in Python in the past, but I don’t know what to do to return to this setting.

I get this error in Python (2.7.11): selenium.common.exceptions.WebDriverException: Message: phantomjs executable must be in PATH.

I tried the "symlink" phantomjs on the path (usr / local / bin [, which is also in the path]), and even manually find / usr / local / bin to put phantomjs in the bin folder. However, in python, there is still a path error.

What am I missing?

+4
source share
4 answers

phantomjs /usr/bin . , , "" , " ...", "/usr/bin". , Mac OS El Capitan ,

+1

- http://phantomjs.org/download.html

/usr/bin Mac, put/bin/phantomjs /usr/local/bin

+2

, executable_path keyword arg . :

driver = webdriver.PhantomJS(executable_path="/Path/to/driver/phantomjs")

, , , .

PhantomJS() pyCharm, .

+2

If you were able to execute in the terminal, just restart PyCharm and it will synchronize the environment variables from the system. (You can check "RUN" => "Change configurations")

+1
source

Source: https://habr.com/ru/post/1629970/


All Articles