python 安装模块报错

环境: ubuntu 17.04
安装模块:M2Crypto
错误error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
猜想:这可能是 linux 的 gcc(c++)的问题
尝试sudo apt-get install c++
sudo apt-get install gc++
重新运行,依然失败,向上追寻错误:
发现许多地方错误与 swig 相关
尝试sudo apt-get install swig
结果: 安装成功
google: swig 是什么

SWIG是一种软件开发工具。它能让一些脚本语言调用C/C++语言的接口。它实现的方法是,通过编译程序将C/C++的声明文件(.i文件)编译成C/C++的包装器源代码(.c或.cxx)。通过直接调用这样的包装器接口,脚本语言可以间接调用C/C++语言的程序接口。SWIG支持的语言有:Perl, Python, Tcl, Ruby, Guile, and Java。使用SWIG通常不需要修改被包装的源程序代码,并且只需要几分钟就能生成你所需要的包装器源代码文件。SWIG使用的场景包括:
1 将C语言的程序包装成解释性语言的接口。
2 快速原型开发
3 可交互式的DEBUG
4 将代码重构成脚本语言

环境: deepin 15.5
安装模块:dateutil
错误ImportError: No module named dateutil.relativedelta
猜想:dateutil 模块没有安装
尝试sudo apt-get install dateutil
结果: 失败 Could not find a version that satisfies the requirement dateutil (from versions: )
No matching distribution found for dateutil

google: sudo apt-get install python-dateutil
结果:安装成功
开始在虚拟环境中安装:
source 后:pip install python-dateutil

模块:rest_framework_jwt
pip install djangorestframework-jwt

模块: corsheaders
pip install django-cors-headers

猜你喜欢

转载自blog.csdn.net/qq_37049781/article/details/80009353