• pip install selenium异常


    error: externally-managed-environment × This environment is externally managed ╰─> To install Python packages system-wide, try brew install xyz, where xyz is the package you are trying to install. If you wish to install a Python library that isn't in Homebrew, use a virtual environment: python3 -m venv path/to/venv source path/to/venv/bin/activate python3 -m pip install xyz If you wish to install a Python application that isn't in Homebrew, it may be easiest to use 'pipx install xyz', which will manage a virtual environment for you. You can install pipx with brew install pipx You may restore the old behavior of pip by passing the '--break-system-packages' flag to pip, or by adding 'break-system-packages = true' to your pip.conf file. The latter will permanently disable this error. If you disable this error, we STRONGLY recommend that you additionally pass the '--user' flag to pip, or set 'user = true' in your pip.conf file. Failure to do this can result in a broken Homebrew installation. Read more about this behavior here: note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification. [notice] A new release of pip is available: 24.0 -> 24.1.2 [notice] To update, run: python3.12 -m pip install --upgrade pip

    1. 创建和使用虚拟环境
    2. 虚拟环境是一个独立于系统Python环境的空间,可以在其中安装和管理Python包。按照以下步骤创建和使用虚拟环境:
    3. 创建虚拟环境:
    4. bash
    5. 复制代码
    6. python3 -m venv myenv
    7. 这将在当前目录下创建一个名为myenv的虚拟环境。
    8. 激活虚拟环境:
    9. 在 Linux 或 MacOS 上:
    10. bash
    11. 复制代码
    12. source myenv/bin/activate
    13. 在 Windows 上:
    14. bash
    15. 复制代码
    16. myenv\Scripts\activate
    17. 当虚拟环境激活后,终端提示符会显示为(myenv),表示你现在在虚拟环境中工作。
    18. 在虚拟环境中安装Selenium:
    19. 确保在虚拟环境中后,使用普通的pip命令来安装Selenium:
    20. bash
    21. 复制代码
    22. pip install selenium
    23. 每次起虚拟环境 进行跑

  • 相关阅读:
    JavaScript系列从入门到精通系列第十七篇:JavaScript中的全局作用域
    Java笔记:阻塞队列
    简简单单理解数据结构
    8、常用基本命令(重要)
    arm_按键中断控制LED、蜂鸣器、风扇
    栅极驱动器SCT52240STDR ,SCT51240TWBR
    税友集团java面试题
    leetcode刷题--栈与递归
    云租赁安全管理制度
    Mellanox网卡工具使用说明
  • 原文地址:https://blog.csdn.net/wolf23151269/article/details/140378434