python splinter一运行就No module named browser
PHP中文网
PHP中文网 2017-04-17 11:42:44
0
2
885

最近要使用splinter进行一些工具开发,在使splinter的过程中遇到一些奇葩问题。 这些相关依赖模块selenium lxml cython我都已经安装 单独使用selenium是没用问题的。但是在使用splinter的时候就有问题 百度谷歌一直找不到错误! 我的错误信息如下: ​from splinter.browser import Browser ImportError: No module named browser ​怎么回事啊,我splinter也正确安装import splinter ,IDE也没用报错,但是一运行就报错,怎么会没有browser模块呢?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
左手右手慢动作

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 named splinter.py in the current directory. Then search for the environment variable PYTHONPATH

The 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

Ty80

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template