【问题标题】:How to make python 3.7 default in Ubuntu 20.04?如何在 Ubuntu 20.04 中默认设置 python 3.7?
【发布时间】:2020-10-29 03:04:14
【问题描述】:

我想在 Ubuntu 20.04 (https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-700/tensorrt-install-guide/index.html#installing-debian) 上为 python3 安装 tensorrt 绑定。此 Ubuntu 默认使用 python 3.8,但这些 tensorrt 绑定需要 python 3.7 或更低版本。

该软件包是通过 sudo apt-get install python3-libnvinfer-dev 安装的。但是这次崩溃是因为 python 3.8 。所以我还通过sudo apt-get install python3.7 安装了python 3.7,所以我可以访问3.7 运行命令 python3.7 。我还制作了一个 ln -s /usr/bin/python3.7 /usr/bin/python3 来制作一个打开 3.7 版本的 python3 命令。但是aptget还是有问题,python3.7对它不可见。我该怎么做才能在 Ubuntu 20.04 中使 python 3.7 本机或如何告诉 apt-get 在 /usr/bin/python3.7 位置中查找?谢谢

【问题讨论】:

  • 你能发布哪个命令给你一个错误和实际的错误信息吗?
  • 是的。使用 sudo apt-get install python3-libnvinfer-dev ,我收到错误Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: python3-libnvinfer : Depends: python3 (< 3.7) but 3.8.2-0ubuntu2 is to be installed E: Unable to correct problems, you have held broken packages. `
  • 哪个python3让我/home/tom/miniconda3/bin/python3.7

标签: python-3.x linux


【解决方案1】:

检查http://web.mit.edu/6.00/www/handouts/pybuntu.html 是否有帮助。 unbuntu 似乎是更新替代品 自己没试过。

【讨论】:

    【解决方案2】:

    这应该可以解决您的问题。但我不知道如何在 Ubuntu 20.04 中将 python3.7 设为默认值。

    Download 你想要的 TensorRT 版本的 tar 文件安装包。提取它。导航到提取的文件夹,然后导航到 python 文件夹。您将找到 TensorRT python API 的 .whl 文件。尝试使用 pip 安装。

    在您的情况下应该是这样的(如果您尝试安装 TensorRT 7.1):

    python3.7 -m pip install tensorrt-7.1.3.4-cp37-none-linux_x86_64.whl
    

    我从TensorRT官方github repository找到这个程序

    【讨论】:

    • 这还不够,.so 文件应该以某种方式到达系统路径以使 trt 可从 python 调用
    猜你喜欢
    • 2020-08-09
    • 2022-08-03
    • 2021-10-11
    • 2020-08-15
    • 1970-01-01
    • 1970-01-01
    • 2021-11-10
    • 1970-01-01
    • 2023-02-01
    相关资源
    最近更新 更多