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

相关推荐
爱吃苹果的梨叔35 分钟前
训练集群网络中断怎么办?智算机房的 Console 串口排障方案
网络·python·智能路由器·php
李妍.4 小时前
02Numpy基础(上)
开发语言·python
TheBestRucy4 小时前
Python 九阳神功之贰:面向对象(下)
开发语言·python
IT小白杨4 小时前
工程视角下的浏览器环境API:资源模型、权限审计与MCP实践
大数据·经验分享·selenium·chrome devtools·安全架构·指纹浏览器
2601_965958464 小时前
口腔黏膜脱皮超2周未愈建议及时就医
人工智能·python
随风而飘1865 小时前
KEITHLEY吉时利 2400 数字源表
人工智能·功能测试·科技·测试工具
微小冷5 小时前
在不同空间中展示数据(欧式、球面、庞加莱圆盘)
python·双曲空间·微分几何·geomstats·庞加莱圆盘·球面
weixin_431600446 小时前
Agent Workflow 学习向:Code 节点,比模板更强的变量加工
后端·python·学习·ai·
讲温控就好了6 小时前
从医疗影像到能源存储——芯片冷却温控技术的跨行业赋能
人工智能·python·能源
DeepVisionary6 小时前
从 Qwen3.8-27B 把原生多模态、原生 FP8、桌面级 Agent 三件事一次集齐,看开源大模型的“工业化拐点“
python·自动化