ModuleNotFoundError:即使安装了webdrivermanager,也没有名为“ webdriver_manager”的模块错误

时间:2020-08-14 23:21:35

标签: python selenium windows-10 sublimetext3 webdrivermanager-python

我已经在enter image description here系统上安装了webdrivermanager

C:\Users\username>pip install webdrivermanager
Requirement already satisfied: webdrivermanager in c:\python\lib\site-packages (0.8.0)
Requirement already satisfied: lxml in c:\python\lib\site-packages (from webdrivermanager) (4.5.1)
Requirement already satisfied: requests in c:\python\lib\site-packages (from webdrivermanager) (2.20.1)
Requirement already satisfied: tqdm in c:\python\lib\site-packages (from webdrivermanager) (4.46.1)
Requirement already satisfied: appdirs in c:\python\lib\site-packages (from webdrivermanager) (1.4.4)
Requirement already satisfied: BeautifulSoup4 in c:\python\lib\site-packages (from webdrivermanager) (4.6.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\python\lib\site-packages (from requests->webdrivermanager) (2018.11.29)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\python\lib\site-packages (from requests->webdrivermanager) (3.0.4)
Requirement already satisfied: idna<2.8,>=2.5 in c:\python\lib\site-packages (from requests->webdrivermanager) (2.7)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\python\lib\site-packages (from requests->webdrivermanager) (1.23)

在我尝试使用webdrivermanager时仍然遇到错误。

  • 代码块:

    from selenium import webdriver
    from webdriver_manager.chrome import ChromeDriverManager
    
    driver = webdriver.Chrome(executable_path=ChromeDriverManager().install())
    driver.get('https://www.google.com/')
    
  • 控制台输出:

    C:\Users\username\Desktop\Debanjan\PyPrograms>webdriverManagerChrome.py
    Traceback (most recent call last):
      File "C:\Users\username\Desktop\Debanjan\PyPrograms\webdriverManagerChrome.py", line 2, in <module>
        from webdriver_manager.chrome import ChromeDriverManager
    ModuleNotFoundError: No module named 'webdriver_manager'  
    

如果我想念东西,有人可以帮我吗?

如果它添加了任何值,我正在使用

4 个答案:

答案 0 :(得分:4)

解决方案:

像这样安装它:

pip install webdriver_manager

代替pip install webdrivermanager

要求:

根据文档,最新版本支持python 3.6或更高版本:

1

参考2

答案 1 :(得分:2)

我发现这个对我有用,所以:

pip3 install webdrivermanager

不确定它是否会帮助任何人,但 pip3 比普通 pip 工作得更好,因为它安装了正确的依赖项

答案 2 :(得分:0)

首先在从python文件路径打开的命令提示符中使用以下命令安装Webdriver Manager。

<?php
// [service_page_carousel]
function service_page_carousel_func() {
        global $post;
        $direct_parent = $post->post_parent;
        $args = array(
            'post_type'      => 'page',
            'posts_per_page' => -1,
            'post_parent'    => $direct_parent,
            'order'          => 'ASC',
            'orderby'        => 'menu_order',
            'post__not_in'   => array( $post->ID ),
        );
        
        $query = new WP_Query( $args );
        
        if ( $query->have_posts() ) : ?>
        
        <div class="service-page-owl-carousel owl-carousel owl-theme owl-loaded owl-drag">
        
        <?php 
        $index = 0;
        while ( $query->have_posts() ) : $query->the_post();
                // Featured image
                $feat_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), "full", true);
        ?>
                <div class="item <?php echo ($index == 0) ? 'active' : ''; ?>">
                    <div class="service">
                        <a href="<?php the_permalink(); ?>"> 
                            <div class="featured-img" style="background-image: url(<?php echo $feat_image[0]; ?>);"></div>
                        </a>
                        <a href="<?php the_permalink(); ?>">
                            <h3 class="brand-secondary"><?php the_title(); ?></h3>
                        </a>
                        <div class="text"><?php the_excerpt(); ?></div>
                        <p class="learn-more"><a class="btn primary" href="<?php the_permalink(); ?>">Learn More</a></p>
                    </div>
                </div>
        <?php endwhile; 
        $index++;
        wp_reset_query(); ?>
        </div>
        
    <?php endif;

} 
add_shortcode( 'service_page_carousel', 'service_page_carousel_func' );

接下来打开pycharm工具并转到pip install webdriver-manager. ,然后单击+图标并搜索webdriver-manager并安装它。

并运行以下代码:

settings -> project interpreter ->

答案 3 :(得分:0)

这对我有用:

python3 -m pip install webdriver-manager

我在窗户上,所以我会留下这个以防它对任何人都有帮助。