Home>

pip install django-toolbeltAfter executingpsycopg2I got an error when installing.
The details of the error are as follows.

Running setup.py install for psycopg2 ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/ttt/Develop/kadai/study101-django-basic/.venv/bin/python3 -u -c'import sys, setuptools, tokenize;sys.argv [0] ='"'"'/private/var/folders/b6/2drgg60j42z3zypzjk9gwsbm0000gn/T/pip-install-u2axu7x_/psycopg2/setup.py'"'"';__file__ ='"'"'/private/var/folders/b6/2drgg60j42z3zypzjk9gwsbm0000g -u2axu7x_/pippg2/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/b6/2drgg60j42z3zypzjk9gwsbm0000gn/T/pip-record-yxoosyft/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ttt/Develop/kadai/study101-django-basic/.venv/include/site/python3.8/psycopg2
         cwd:/private/var/folders/b6/2drgg60j42z3zypzjk9gwsbm0000gn/T/pip-install-u2axu7x_/psycopg2 /
    Complete output (139 lines):
    running install
    running build
    running build_py
    creating build
    creating build /lib.macosx-10.14.6-x86_64-3.8
    creating build /lib.macosx-10.14.6-x86_64-3.8/psycopg2
    copying lib/_json.py->build/lib.macosx-10.14.6-x86_64-3.8/psycopg2
    copying lib/extras.py->build/lib.macosx-10.14.6-x86_64-3.8/psycopg2
    copying lib/compat.py->build/lib.macosx-10.14.6-x86_64-3.8/psycopg2
    copying lib/errorcodes.py->build/lib.macosx-10.14.6-x86_64-3.8/psycopg2
    copying lib/tz.py->build/lib.macosx-10.14.6-x86_64-3.8/psycopg2
    copying lib/_range.py->build/lib.macosx-10.14.6-x86_64-3.8/psycopg2
    copying lib/_ipaddress.py->build/lib.macosx-10.14.6-x86_64-3.8/psycopg2
    copying lib/_lru_cache.py->build/lib.macosx-10.14.6-x86_64-3.8/psycopg2
    copying lib/__ init__.py->build/lib.macosx-10.14.6-x86_64-3.8/psycopg2
    copying lib/extensions.py->build/lib.macosx-10.14.6-x86_64-3.8/psycopg2
    copying lib/errors.py->build/lib.macosx-10.14.6-x86_64-3.8/psycopg2
    copying lib/sql.py->build/lib.macosx-10.14.6-x86_64-3.8/psycopg2
    copying lib/pool.py->build/lib.macosx-10.14.6-x86_64-3.8/psycopg2
    running build_ext
    building'psycopg2._psycopg' extension
    creating build /temp.macosx-10.14.6-x86_64-3.8
    creating build /temp.macosx-10.14.6-x86_64-3.8/psycopg
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -DPSYCOPG_VERSION = 2.8.6 (dt dec pq3 ext lo64) -DPG_VERSION_NUM = 120003 -DHAVE_LO64 = 1 -I /Users/ttt/Develop/kadai/study101-django-basic/.venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8- I. -I/usr/local/include -I/usr/local/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.14.6-x86_64-3.8 /psycopg/psycopgmodule.o
    In file included from psycopg/psycopgmodule.c: 28:
    In file included from ./psycopg/psycopg.h:35:
    In file included from

Since the number of characters is limited, the full text of the error content isjsfiddleI uploaded it at.
Installing Xcode command line toolsQiitaRefer to the article,env CFLAGS = -stdlib = libc ++ pip install django-toolbeltI tried, but the error could not be resolved.

I would appreciate it if anyone could give me some advice regarding the cause of the error.

* Environmental information
・ MacOS "10.15.7"
・ Xcode "12.2"

  • Answer # 1

    export ARCHFLAGS = "-arch x86_64"And runpip install psycopg2After executing,
    The following is displayed and the installation was successful.

    Collecting psycopg2
      Using cached psycopg2-2.8.6.tar.gz (383 kB)
    Using legacy'setup.py install' for psycopg2, since package'wheel' is not installed.
    Installing collected packages: psycopg2
        Running setup.py install for psycopg2 ... done
    Successfully installed psycopg2-2.8.6


    But,Using legacy'setup.py install' for psycopg2, since package'wheel' is not installed.Was displayed, so referring to the stackoverflow article, I executed the following command just in case, and installed it again.

    pip uninstall psycopg2
    pip list --outdated
    pip install --upgrade wheel
    pip install --upgrade setuptools
    pip install psycopg2