安装requirements.txt会在Django

时间:2019-12-09 07:40:41

标签: python django django-models

直到最近,当我为数据库创建模型并尝试插入安装require.txt时,该项目才能正常运行。我已经做了所有我知道的事情,包括修改我的settings.py以添加缺少的库,重新安装djangopsycopg2,但都无济于事。这是我的requirement.txt

tweepy==3.8.0
django
gunicorn
django-heroku

我得到的错误:

 ld: library not found for -lssl
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/Users/apple/Downloads/font_text/python-getting-started/getting-started/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/tn/843ff_ns4j5ddf0fyc998v6c0000gn/T/pip-install-phi9wroh/psycopg2/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/tn/843ff_ns4j5ddf0fyc998v6c0000gn/T/pip-record-sc3y24vo/install-record.txt --single-version-externally-managed --compile --install-headers /Users/apple/###/###/PROJECTFOLDER/getting-started/include/site/python3.7/psycopg2" failed with error code 1 in /private/var/folders/tn/843ff_ns4j5ddf0fyc998v6c0000gn/T/pip-install-phi9wroh/psycopg2/

3 个答案:

答案 0 :(得分:2)

根据错误消息,您需要在系统上安装openssl-devel软件包。

答案 1 :(得分:2)

经过长时间的搜索和试验,我终于能够解决问题。但是我仍在调查真正可能导致错误的原因。无论如何,这是解决问题的方法

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
pip install psycopg2

我在这里找到它:error installing psycopg2, library not found for -lssl

答案 2 :(得分:0)

您需要重新安装gcc,gcc-c ++和依赖项。

对于python 2.7

$ sudo yum -y install gcc gcc-c++ kernel-devel
$ sudo yum -y install python-devel libxslt-devel libffi-devel openssl-devel
$ pip install "your python packet"

对于python 3.4

$ sudo apt-get install python3-dev
$ pip install "your python packet"

希望这会有所帮助。