python 安装模块报错

素颜马尾好姑娘i 2022-05-27 13:41 779阅读 0赞

环境: 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
结果:安装成功
错误:SWIG/_m2crypto.i:54: Error: Unable to find 'openssl/opensslv.h' SWIG/_m2crypto.i:60: Error: Unable to find 'openssl/safestack.h' SWIG/_evp.i:12: Error: Unable to find 'openssl/opensslconf.h' SWIG/_rc4.i:5: Error: Unable to find 'openssl/opensslconf.h' SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h' error: command 'swig' failed with exit status 1
执行: sudo apt-get install libssl-dev

开始在虚拟环境中安装:
source 后:pip install python-dateutil

模块:rest_framework_jwt
pip install djangorestframework-jwt

模块: corsheaders
pip install django-cors-headers

发表评论

表情:
评论列表 (有 0 条评论,779人围观)

还没有评论,来说两句吧...

相关阅读

    相关 解决Python:无此模块

    在Python中,当你尝试导入一个没有安装或不在Python搜索路径中的模块时,就会出现“无此模块”的错误。 以下是解决此类问题的步骤: 1. **检查拼写**:确保你正确