在 ubuntu 20.04 LTS 上部署 django 2.2 应用程序

Posted

技术标签:

【中文标题】在 ubuntu 20.04 LTS 上部署 django 2.2 应用程序【英文标题】:Deploying django 2.2 app on ubuntu 20.04 LTS 【发布时间】:2021-08-07 04:51:27 【问题描述】:

我之前使用 python 3.6 编写过我的应用程序。 现在我想在 ubuntu 20.04 上部署它,默认 python 是 3.8。 在我运行 pip install -r requirments.txt 创建虚拟环境后,我收到终端中特定包的错误。以下是这些包的错误:


    Building wheel for cffi (setup.py) ... error
     ERROR: Command errored out with exit status 1:
      command: /home/pouya795/www/marketpine-backend/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2h487j4r/cffi_5a23efe094aa4c5dbccb0ae69bfca883/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2h487j4r/cffi_5a23efe094aa4c5dbccb0ae69bfca883/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-2i6w3ayj
          cwd: /tmp/pip-install-2h487j4r/cffi_5a23efe094aa4c5dbccb0ae69bfca883/
     Complete output (36 lines):

     running build_ext
     building '_cffi_backend' extension
     creating build/temp.linux-x86_64-3.8
     creating build/temp.linux-x86_64-3.8/c
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.8/c/_cffi_backend.o
     c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
        15 | #include <ffi.h>
           |          ^~~~~~~
     compilation terminated.
     error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
     ----------------------------------------
     ERROR: Failed building wheel for cffi
     Running setup.py clean for cffi
     Building wheel for Pillow (setup.py) ... error
     ERROR: Command errored out with exit status 1:
      command: /home/pouya795/www/marketpine-backend/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2h487j4r/pillow_d6fb8321e9754e1ca160d90143900a30/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2h487j4r/pillow_d6fb8321e9754e1ca160d90143900a30/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-q3h8ccal
          cwd: /tmp/pip-install-2h487j4r/pillow_d6fb8321e9754e1ca160d90143900a30/
     Complete output (176 lines):
     running bdist_wheel
     running build
     running build_py
     creating build
     creating build/lib.linux-x86_64-3.8
     creating build/lib.linux-x86_64-3.8/PIL
   
    running egg_info
     writing src/Pillow.egg-info/PKG-INFO
     writing dependency_links to src/Pillow.egg-info/dependency_links.txt
     writing top-level names to src/Pillow.egg-info/top_level.txt
     adding license file 'LICENSE' (matched pattern 'LICEN[CS]E*')
     reading manifest file 'src/Pillow.egg-info/SOURCES.txt'
     reading manifest template 'MANIFEST.in'
     warning: no files found matching '*.c'
     warning: no files found matching '*.h'
     warning: no files found matching '*.sh'
     no previously-included directories found matching 'docs/_static'
     writing manifest file 'src/Pillow.egg-info/SOURCES.txt'
     running build_ext
   
   
     The headers or library files could not be found for jpeg,
     a required dependency when compiling Pillow from source.
   
     Please see the install instructions at:
        https://pillow.readthedocs.io/en/latest/installation.html
   
     Traceback (most recent call last):
       File "/tmp/pip-install-2h487j4r/pillow_d6fb8321e9754e1ca160d90143900a30/setup.py", line 839, in <module>
         setup(
       File "/home/pouya795/www/marketpine-backend/venv/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
         return distutils.core.setup(**attrs)
       File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
         dist.run_commands()
       File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
         self.run_command(cmd)
       File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
         cmd_obj.run()
       File "/home/pouya795/www/marketpine-backend/venv/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 299, in run      self.run_command('build')
       File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
         self.distribution.run_command(command)
       File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
         cmd_obj.run()
       File "/usr/lib/python3.8/distutils/command/build.py", line 135, in run
         self.run_command(cmd_name)
       File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
         self.distribution.run_command(command)
       File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
         cmd_obj.run()
       File "/usr/lib/python3.8/distutils/command/build_ext.py", line 340, in run
         self.build_extensions()
       File "/tmp/pip-install-2h487j4r/pillow_d6fb8321e9754e1ca160d90143900a30/setup.py", line 674, in build_extensions
         raise RequiredDependencyException(f)
     __main__.RequiredDependencyException: jpeg
   
     During handling of the above exception, another exception occurred:
   
     Traceback (most recent call last):
       File "<string>", line 1, in <module>
       File "/tmp/pip-install-2h487j4r/pillow_d6fb8321e9754e1ca160d90143900a30/setup.py", line 888, in <module>
         raise RequiredDependencyException(msg)
     __main__.RequiredDependencyException:
   
     The headers or library files could not be found for jpeg,
     a required dependency when compiling Pillow from source.
   
     Please see the install instructions at:
        https://pillow.readthedocs.io/en/latest/installation.html
   
   
     ----------------------------------------
     ERROR: Failed building wheel for Pillow
     Running setup.py clean for Pillow
     Building wheel for typed-ast (setup.py) ... error
     ERROR: Command errored out with exit status 1:
      command: /home/pouya795/www/marketpine-backend/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2h487j4r/typed-ast_179d0c2213394989ae0f950fdc92fb1a/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2h487j4r/typed-ast_179d0c2213394989ae0f950fdc92fb1a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-85kkgv7d
          cwd: /tmp/pip-install-2h487j4r/typed-ast_179d0c2213394989ae0f950fdc92fb1a/
     Complete output (67 lines):
     running bdist_wheel
     running build
     running build_py
     creating build
     creating build/lib.linux-x86_64-3.8
     creating build/lib.linux-x86_64-3.8/typed_ast
     copying typed_ast/ast3.py -> build/lib.linux-x86_64-3.8/typed_ast
     copying typed_ast/ast27.py -> build/lib.linux-x86_64-3.8/typed_ast
     copying typed_ast/conversions.py -> build/lib.linux-x86_64-3.8/typed_ast
     copying typed_ast/__init__.py -> build/lib.linux-x86_64-3.8/typed_ast
     package init file 'ast3/tests/__init__.py' not found (or not a regular file)
     creating build/lib.linux-x86_64-3.8/typed_ast/tests
     copying ast3/tests/test_basics.py -> build/lib.linux-x86_64-3.8/typed_ast/tests
     running build_ext
     building '_ast27' extension
     creating build/temp.linux-x86_64-3.8
     creating build/temp.linux-x86_64-3.8/ast27
     creating build/temp.linux-x86_64-3.8/ast27/Parser
     creating build/temp.linux-x86_64-3.8/ast27/Python
     creating build/temp.linux-x86_64-3.8/ast27/Custom
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Parser/acceler.c -o build/temp.linux-x86_64-3.8/ast27/Parser/acceler.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Parser/bitset.c -o build/temp.linux-x86_64-3.8/ast27/Parser/bitset.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Parser/grammar.c -o build/temp.linux-x86_64-3.8/ast27/Parser/grammar.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Parser/grammar1.c -o build/temp.linux-x86_64-3.8/ast27/Parser/grammar1.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Parser/node.c -o build/temp.linux-x86_64-3.8/ast27/Parser/node.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Parser/parser.c -o build/temp.linux-x86_64-3.8/ast27/Parser/parser.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Parser/parsetok.c -o build/temp.linux-x86_64-3.8/ast27/Parser/parsetok.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Parser/tokenizer.c -o build/temp.linux-x86_64-3.8/ast27/Parser/tokenizer.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Python/asdl.c -o build/temp.linux-x86_64-3.8/ast27/Python/asdl.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Python/ast.c -o build/temp.linux-x86_64-3.8/ast27/Python/ast.o
     ast27/Python/ast.c: In function ‘ast_for_print_stmt’:
     ast27/Python/ast.c:2432:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
      2432 |         if (!dest)
           |         ^~
     ast27/Python/ast.c:2434:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
      2434 |             start = 4;
           |             ^~~~~
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Python/graminit.c -o build/temp.linux-x86_64-3.8/ast27/Python/graminit.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Python/mystrtoul.c -o build/temp.linux-x86_64-3.8/ast27/Python/mystrtoul.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Python/Python-ast.c -o build/temp.linux-x86_64-3.8/ast27/Python/Python-ast.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast27/Custom/typed_ast.c -o build/temp.linux-x86_64-3.8/ast27/Custom/typed_ast.o
     x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.8/ast27/Parser/acceler.o build/temp.linux-x86_64-3.8/ast27/Parser/bitset.o build/temp.linux-x86_64-3.8/ast27/Parser/grammar.o build/temp.linux-x86_64-3.8/ast27/Parser/grammar1.o build/temp.linux-x86_64-3.8/ast27/Parser/node.o build/temp.linux-x86_64-3.8/ast27/Parser/parser.o build/temp.linux-x86_64-3.8/ast27/Parser/parsetok.o build/temp.linux-x86_64-3.8/ast27/Parser/tokenizer.o build/temp.linux-x86_64-3.8/ast27/Python/asdl.o build/temp.linux-x86_64-3.8/ast27/Python/ast.o build/temp.linux-x86_64-3.8/ast27/Python/graminit.o build/temp.linux-x86_64-3.8/ast27/Python/mystrtoul.o build/temp.linux-x86_64-3.8/ast27/Python/Python-ast.o build/temp.linux-x86_64-3.8/ast27/Custom/typed_ast.o -o build/lib.linux-x86_64-3.8/typed_ast/_ast27.cpython-38-x86_64-linux-gnu.so
     building '_ast3' extension
     creating build/temp.linux-x86_64-3.8/ast3
     creating build/temp.linux-x86_64-3.8/ast3/Parser
     creating build/temp.linux-x86_64-3.8/ast3/Python
     creating build/temp.linux-x86_64-3.8/ast3/Custom
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast3/Parser/acceler.c -o build/temp.linux-x86_64-3.8/ast3/Parser/acceler.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast3/Parser/bitset.c -o build/temp.linux-x86_64-3.8/ast3/Parser/bitset.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast3/Parser/grammar.c -o build/temp.linux-x86_64-3.8/ast3/Parser/grammar.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast3/Parser/grammar1.c -o build/temp.linux-x86_64-3.8/ast3/Parser/grammar1.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast3/Parser/node.c -o build/temp.linux-x86_64-3.8/ast3/Parser/node.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast3/Parser/parser.c -o build/temp.linux-x86_64-3.8/ast3/Parser/parser.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast3/Parser/parsetok.c -o build/temp.linux-x86_64-3.8/ast3/Parser/parsetok.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast3/Parser/tokenizer.c -o build/temp.linux-x86_64-3.8/ast3/Parser/tokenizer.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast3/Python/asdl.c -o build/temp.linux-x86_64-3.8/ast3/Python/asdl.o
     x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/home/pouya795/www/marketpine-backend/venv/include -I/usr/include/python3.8 -c ast3/Python/ast.c -o build/temp.linux-x86_64-3.8/ast3/Python/ast.o
     ast3/Python/ast.c:22:1: error: conflicting types for ‘_PyObject_FastCall’
        22 | _PyObject_FastCall(PyObject *func, PyObject *const *args, int nargs)
           | ^~~~~~~~~~~~~~~~~~
     In file included from /usr/include/python3.8/abstract.h:837,
                      from /usr/include/python3.8/Python.h:147,
                      from ast3/Python/ast.c:6:
     /usr/include/python3.8/cpython/abstract.h:145:1: note: previous definition of ‘_PyObject_FastCall’ was here
       145 | _PyObject_FastCall(PyObject *func, PyObject *const *args, Py_ssize_t nargs)
           | ^~~~~~~~~~~~~~~~~~
     error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
     ----------------------------------------
     ERROR: Failed building wheel for typed-ast

这是我的 requrements.txt 文件:

addict==2.2.1
appdirs==1.4.3
asn1crypto==0.24.0
attrs==19.1.0
cached-property==1.5.1
certifi==2019.3.9
cffi==1.12.3
chardet==3.0.4
Click==7.0
coreapi==2.3.3
coreschema==0.0.4
cryptography==2.6.1
defusedxml==0.6.0
Django==2.2
django-background-tasks==1.2.5
django-cleanup==4.0.0
django-compat==1.0.15
django-cors-headers==2.5.2
django-rest-swagger==2.2.0
django-stubs==0.12.1
djangorestframework==3.9.2
djangorestframework-jwt==1.11.0
djangorestframework-stubs==0.4.2
drf-writable-nested==0.5.4
Faker==1.0.5
future==0.17.1
gunicorn==19.9.0
idna==2.8
inflection==0.3.1
isodate==0.6.0
itypes==1.1.0
jdatetime==3.6.2
Jinja2==2.10.1
jsonschema==3.0.1
kavenegar==1.1.2
langdetect==1.0.7
lxml==4.4.1
Markdown==3.1.1
MarkupSafe==1.1.1
mypy==0.701
mypy-extensions==0.4.1
openapi-codec==1.3.2
Pillow==6.1.0
pyaes==1.6.1
pycparser==2.19
PyJWT==1.7.1
Pyrogram==0.8.0
pyrsistent==0.15.4
PySocks==1.6.8
python-dateutil==2.8.0
python-telegram-bot==11.1.0
pytz==2019.1
PyYAML==5.1
requests==2.21.0
requests-toolbelt==0.9.1
rope==0.14.0
ruamel.yaml==0.16.0
ruamel.yaml.clib==0.1.0
simplejson==3.16.0
six==1.12.0
sqlparse==0.3.0
StringGenerator==0.3.3
swagger-spec-validator==2.4.3
text-unidecode==1.2
TgCrypto==1.1.1
typed-ast==1.3.5
typing-extensions==3.7.2
uritemplate==3.0.0
urllib3==1.24.1
zeep==3.4.0

我认为它与 3 个包有关:cffi、Pillow 和 typed-ast 应用程序在 ubuntu 18.04 LTS 上也能正常工作。 有人知道这个问题的根本原因吗?

【问题讨论】:

【参考方案1】:
fatal error: ffi.h: No such file or directory

要解决这个问题,您应该安装 libffi-dev。

 ast3/Python/ast.c:22:1: error: conflicting types for ‘_PyObject_FastCall’

这与this bug 相关,似乎可以通过安装/升级typed-ast 和/或将python 升级到更新的次要版本来修复它。

【讨论】:

以上是关于在 ubuntu 20.04 LTS 上部署 django 2.2 应用程序的主要内容,如果未能解决你的问题,请参考以下文章

在 Ubuntu 20.04 LTS(Vmware)上安装 docker 失败

我应该如何在 Ubuntu 20.04 LTS 上安装 Django

SoapUI 5.6.0 无法在 Ubuntu 20.04 LTS 上安装

如何在 Ubuntu 20.04 LTS 上安装 libwebkitgtk 包?

如何在Ubuntu 20.04 LTS上安装Redmine

如何在Ubuntu 20.04 LTS上安装Squid Proxy