Python-3.8.3 Linux Edition 安装手顺

1. 背景

     Linux Python例子作成时需要Python环境,需要手动安装。

 

2. 所需材料

Python Linux Edition :Python-3.8.3.tgz

安装OS:(文档作成时的安装OS)

             Ubuntu 20.04 LTS (kernel 5.4.0-26-generic)(64bit US)

             Ubuntu 18.04.3 LTS (kernel 5.0.0-23-generic)(64bit US)

3. 安装步骤

  • 安装所需lib

sudo apt-get update

sudo apt-get install zlib1g-dev

sudo apt-get install libffi-dev

  • 安装Python-3.8.3

tar -xvf Python-3.8.3.tgz

cd Python-3.8.3

./configure

make

make test

sudo make install

  • 运行例子以inout为例

python3 inout

 

4. 缺少库文件时报的错误

  • 缺少zlib1g-dev

在make test时有以下错误

== Tests result: FAILURE then FAILURE ==

392 tests OK.

2 tests failed:

    test_importlib test_normalization

29 tests skipped:

    test_bz2 test_ctypes test_curses test_dbm_gnu test_dbm_ndbm

    test_devpoll test_gzip test_idle test_ioctl test_kqueue test_lzma

    test_msilib test_ossaudiodev test_readline test_smtpnet

    test_sqlite test_ssl test_startfile test_tcl test_tix test_tk

    test_ttk_guionly test_ttk_textonly test_turtle test_winconsoleio

    test_winreg test_winsound test_zipfile64 test_zlib

2 re-run tests:

    test_importlib test_normalization

Total duration: 4 min 35 sec

Tests result: FAILURE then FAILURE

make: *** [Makefile:1130: test] Error 2

 

  • 缺少libffi-dev

执行例子时报错:

Traceback (most recent call last):

  File "inout.py", line 3, in <module>

    import ctypes

  File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>

    from _ctypes import Union, Structure, Array

ModuleNotFoundError: No module named '_ctypes'

 

备注:如果先安装了Python-3.8.3再安装lib需要重新安装Python-3.8.3

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值