Deepin V20 初体验-----配置默认Python版本及第三方库配置

    技术2026-01-31  4

    Python的配置

        使用Deepin Linux系统,自带Python 2.7 和 Python 3.7 版本,可以选择使用:

        python 命令运行2.7版本; python3 命令运行3.7版本; 或者使用以下方案配置默认Python版本

        修改~/.bashrc文件,添加 alias python='python3'

    sudo dedit ~/.bashrc #添加 ~/.bashrc lxj@lxj-PC:~$ python Python 3.7.3 (default, Apr 3 2019, 05:39:12) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>>

    Linux环境下Python第三方库的配置:使用的Python第三方库管理工具:pip

    如果电脑中同时存在Python 2.x 和 3.x两种版本,对于一些区分Python版本的第三方库(例如opencv),使用pip安装时将默认配置给Python2.x版本,此时可以尝试使用pip3工具

    pip以及pip3的安装方法:

    sudo apt-get install python-pip # 安装pip工具,使用pip或pip2命令调用 sudo apt-get install python-pip3 # 安装pip3工具,使用pip3命令调用

    欲安装的第三方示例库:numpy、pandas、scipy

    pip install numpy pip3 install numpy # 或者直接使用 sudo apt-get install python-numpy

     

    Processed: 0.015, SQL: 9