尝试为Django安装JWT软件包时出现错误:命令'x86_64-linux-gnu-gcc'失败,退出状态为1

时间:2018-12-24 09:53:36

标签: django install jwt

我正在处理django项目,但收到错误

ImproperlyConfigured: Error importing middleware erp.middleware: "No module named jwt"
这样我尝试通过输入

来安装jwt软件包

pip install jwt

这会导致错误

 build/temp.linux-x86_64-2.7/_openssl.c:3551:13: warning: ‘_ssl_thread_locking_function’ defined but not used [-Wunused-function]
     static void _ssl_thread_locking_function(int mode, int n, const char *file,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
  Rolling back uninstall of cryptography
Command "/home/charles/.virtualenvs/virtualenvpython/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-hU6Fxe/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-h5K4aB/install-record.txt --single-version-externally-managed --compile --install-headers /home/charles/.virtualenvs/virtualenvpython/include/site/python2.7/cryptography" failed with error code 1 in /tmp/pip-install-hU6Fxe/cryptography/

我不知道发生了什么问题,请帮助我解决此问题 我正在使用ubuntu 18.04 LTS python 2.7.15rc1 Django 1.3.7

1 个答案:

答案 0 :(得分:2)

尝试这些命令

sudo apt-get install python-dev
sudo apt-get install libffi-dev

我建议使用最新版本的python和Django。