【问题标题】:After switching to Python 3.6.5_1, the displayed version is still 3.7.2切换到Python 3.6.5_1后,显示的版本还是3.7.2
【发布时间】:2019-06-10 01:15:39
【问题描述】:

我正在尝试将 Python 3.6.5_1 用于 OpenCV,因此我使用“brew switch python 3.6.5_1”切换了 Python 版本,但是在使用“python --version”检查了我当前的 Python 版本之后,我显然是仍在使用 Python 3.7.2 版。有什么解决办法吗?顺便说一下,这是我正在关注的教程:https://www.pyimagesearch.com/2018/08/17/install-opencv-4-on-macos/

【问题讨论】:

    标签: python python-3.x macos terminal homebrew


    【解决方案1】:

    检查您的 python 路径以查看您的 python 可执行文件存储在终端中的位置---which python 在终端中。我敢打赌它仍然指向你的 3.7.2 目录的 python。

    【讨论】:

    • 另外,检查 type python 的内容——这将显示是否存在覆盖正常 PATH 搜索的别名或函数。
    【解决方案2】:

    如果你在 python 版本之间切换,virtualenv 可用于初始化具有特定 python 版本的隔离环境。

    virtualenv -p [preferred-python-version] open_cv_project_env

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-12
      • 1970-01-01
      • 1970-01-01
      • 2021-01-29
      相关资源
      最近更新 更多