记录成功配置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.

python 复制代码
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秒

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包成功

相关推荐
清水白石0088 分钟前
解构异步编程的两种哲学:从 asyncio 到 Trio,理解 Nursery 的魔力
运维·服务器·数据库·python
山海青风13 分钟前
图像识别零基础实战入门 1 计算机如何“看”一张图片
图像处理·python
彼岸花开了吗41 分钟前
构建AI智能体:八十、SVD知识整理与降维:从数据混沌到语义秩序的智能转换
人工智能·python·llm
山土成旧客1 小时前
【Python学习打卡-Day40】从“能跑就行”到“工程标准”:PyTorch训练与测试的规范化写法
pytorch·python·学习
闲人编程1 小时前
消息通知系统实现:构建高可用、可扩展的企业级通知服务
java·服务器·网络·python·消息队列·异步处理·分发器
大神君Bob1 小时前
【AI办公自动化】如何使用Pytho让Excel表格处理自动化
python
Heorine1 小时前
数学建模 绘图 图表 可视化(6)
python·数学建模·数据可视化
栈与堆1 小时前
LeetCode-1-两数之和
java·数据结构·后端·python·算法·leetcode·rust
智航GIS2 小时前
10.7 pyspider 库入门
开发语言·前端·python
副露のmagic2 小时前
更弱智的算法学习 day25
python·学习·算法