• 记录成功配置anaconda后下载selenium包运行项目时遇到的问题


    记录成功配置anaconda后导入selenium包运行项目时遇到的问题

    1、编写py代码后导入selenium包时出现提示警告

    Installing packages into ‘E:\anaconda3’ requires administrator privileges. Confgure a per-project virtual environment as your project interpreter to avoidnstalling packages to a protected area of the file system.

    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    from selenium.webdriver.chrome.service import Service
    # 导入webdriver模块
    import time                                                     # 导入时间相关的库
    
    #webdriver的路径
    # driver_path = 'E:\\tools\msedgedriver.exe'
    # #固定搭配直接用就行了
    # service = Service(executable_path=driver_path)
    #
    # driver = webdriver.Edge(service=service)                      # 新建一个webdriver的实例
    driver = webdriver.Edge()                      # 新建一个webdriver的实例
    
    driver.get("https://www.baidu.com")
    
    time.sleep(10)                                                   # 休眠2秒
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    2、出现这个提示是因为你在下载selenium包时,没有管理员权限。

    安装包到系统目录需要管理员权限,而你可能没有这个权限。如果忽略这个警告直接继续安装的话会导致下载selenium包失败,并提示错误
    EnvironmentNotWritableError: The current user does not have write permissions to the target environment. environment location: E:\anaconda3

    3、解决方法是退出pycharm,右键pycharm快捷方式以管理员身份运行

    重新导入selenium包,此时便不会提示任何警告且下载selenium包成功

  • 相关阅读:
    GDB使用技巧和相关插件
    使用 prometheus 监控主机
    基于FPGA的EMAC模块与FIFO模块:高速数据传输与存储
    从北京“润”到芝加哥,工程师宝玉“滋润”成长的秘诀
    Linux学习之HTTP
    深入了解Java 8 新特性:lambda表达式进阶
    分布式缓存Spring Cache
    02-PG配置文件说明
    Clickhouse中的预聚合引擎
    【前端设计模式】之代理模式
  • 原文地址:https://blog.csdn.net/seabirdssss/article/details/138039495