最近要使用splinter进行一些工具开发,在使splinter的过程中遇到一些奇葩问题。 这些相关依赖模块selenium lxml cython我都已经安装 单独使用selenium是没用问题的。但是在使用splinter的时候就有问题 百度谷歌一直找不到错误! 我的错误信息如下: from splinter.browser import Browser ImportError: No module named browser 怎么回事啊,我splinter也正确安装import splinter ,IDE也没用报错,但是一运行就报错,怎么会没有browser模块呢?
This is a common mistake made by novices. The problem lies in not understanding the python module search path.
Import module
from splinter.browser import Browser
and first search for files namedsplinter.py
in the current directory. Then search for the environment variable PYTHONPATHThe search directory contains and first searches the directory where the current script is running, so the name of the script must not have the same name as the module name, otherwise the script will be loaded as a module.
Refer to official documentation
I also encountered such a problem, the solution is not to start the file name with splinter.py, it can be aa.py, bb.py