pycharm新建django项目报错

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting django Using cached https://pypi.tuna.tsinghua.edu.cn/packages/9b/41/e1e7d6ecc3bc76681dfdc6b373566822bc2aab96fa3eceaaed70accc28b6/Django-4.1-py3-none-any.whl (8.1 MB) Collecting asgiref<4,>=3.5.2 Using cached https://pypi.tuna.tsinghua.edu.cn/packages/af/6d/ea3a5c3027c3f14b0321cd4f7e594c776ebe64e4b927432ca6917512a4f7/asgiref-3.5.2-py3-none-any.whl (22 kB) Collecting backports.zoneinfo Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ad/85/475e514c3140937cf435954f78dedea1861aeab7662d11de232bdaa90655/backports.zoneinfo-0.2.1.tar.gz (74 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing wheel metadata: started Preparing wheel metadata: finished with status 'done' Collecting sqlparse>=0.2.2 Using cached https://pypi.tuna.tsinghua.edu.cn/packages/05/40/d836d55fb3f467243ee839ab7b814822fda522cd395fa41e282684e71ee5/sqlparse-0.4.2-py3-none-any.whl (42 kB) Building wheels for collected packages: backports.zoneinfo Building wheel for backports.zoneinfo (PEP 517): started Building wheel for backports.zoneinfo (PEP 517): finished with status 'error' Failed to build backports.zoneinfo

ERROR: Command errored out with exit status 1: command: /Users/huzhuo/git/test/venv/bin/python /Users/huzhuo/git/test/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/xg/w6gk0mw94tv044d8q75zfd440000gn/T/tmpu942vya4 cwd: /private/var/folders/xg/w6gk0mw94tv044d8q75zfd440000gn/T/pip-install-29wrwokt/backports-zoneinfo_3a4ebebd1e654b67b1718d9aaf1925e9 Complete output (43 lines): /private/var/folders/xg/w6gk0mw94tv044d8q75zfd440000gn/T/pip-build-env-7xbrih3v/overlay/lib/python3.8/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead. warnings.warn(msg, warning_class) running bdist_wheel running build running build_py creating build creating build/lib.macosx-10.14.6-arm64-cpython-38 creating build/lib.macosx-10.14.6-arm64-cpython-38/backports copying src/backports/init.py -> build/lib.macosx-10.14.6-arm64-cpython-38/backports creating build/lib.macosx-10.14.6-arm64-cpython-38/backports/zoneinfo copying src/backports/zoneinfo/_version.py -> build/lib.macosx-10.14.6-arm64-cpython-38/backports/zoneinfo copying src/backports/zoneinfo/_common.py -> build/lib.macosx-10.14.6-arm64-cpython-38/backports/zoneinfo copying src/backports/zoneinfo/init.py -> build/lib.macosx-10.14.6-arm64-cpython-38/backports/zoneinfo copying src/backports/zoneinfo/_zoneinfo.py -> build/lib.macosx-10.14.6-arm64-cpython-38/backports/zoneinfo copying src/backports/zoneinfo/_tzpath.py -> build/lib.macosx-10.14.6-arm64-cpython-38/backports/zoneinfo running egg_info writing src/backports.zoneinfo.egg-info/PKG-INFO writing dependency_links to src/backports.zoneinfo.egg-info/dependency_links.txt writing requirements to src/backports.zoneinfo.egg-info/requires.txt writing top-level names to src/backports.zoneinfo.egg-info/top_level.txt reading manifest file 'src/backports.zoneinfo.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching '.png' under directory 'docs' warning: no files found matching '.svg' under directory 'docs' no previously-included directories found matching 'docs/_build' no previously-included directories found matching 'docs/_output' adding license file 'LICENSE' adding license file 'licenses/LICENSE_APACHE' writing manifest file 'src/backports.zoneinfo.egg-info/SOURCES.txt' copying src/backports/zoneinfo/init.pyi -> build/lib.macosx-10.14.6-arm64-cpython-38/backports/zoneinfo copying src/backports/zoneinfo/py.typed -> build/lib.macosx-10.14.6-arm64-cpython-38/backports/zoneinfo warning: build_py: byte-compiling is disabled, skipping.

running build_ext building 'backports.zoneinfo._czoneinfo' extension creating build/temp.macosx-10.14.6-arm64-cpython-38 creating build/temp.macosx-10.14.6-arm64-cpython-38/lib 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 -Werror=implicit-function-declaration -I/Users/huzhuo/git/test/venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c lib/zoneinfo_module.c -o build/temp.macosx-10.14.6-arm64-cpython-38/lib/zoneinfo_module.o -std=c99 lib/zoneinfo_module.c:1:10: fatal error: 'Python.h' file not found #include "Python.h" ^~~~~~~~~~ 1 error generated. error: command '/usr/bin/clang' failed with exit code 1


ERROR: Failed building wheel for backports.zoneinfo ERROR: Could not build wheels for backports.zoneinfo which use PEP 517 and cannot be installed directly WARNING: You are using pip version 21.1.2; however, version 22.2.2 is available. You should consider upgrading via the '/Users/huzhuo/git/test/venv/bin/python -m pip install --upgrade pip' command.

评论 2

  • 终端可以正常安装django: huzhuo@huzhuodeMacBook-Pro ~ % pip3 install django WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. Defaulting to user installation because normal site-packages is not writeable Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Requirement already satisfied: django in ./Library/Python/3.8/lib/python/site-packages (3.2) Requirement already satisfied: asgiref<4,>=3.3.2 in ./Library/Python/3.8/lib/python/site-packages (from django) (3.5.2) Requirement already satisfied: sqlparse>=0.2.2 in ./Library/Python/3.8/lib/python/site-packages (from django) (0.4.2) Requirement already satisfied: pytz in ./Library/Python/3.8/lib/python/site-packages (from django) (2022.2.1) huzhuo@huzhuodeMacBook-Pro ~ %

    pycharm自动生成的虚拟环境安装不了: 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 -Werror=implicit-function-declaration -I/Users/huzhuo/git/test/venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c lib/zoneinfo_module.c -o build/temp.macosx-10.14.6-arm64-cpython-38/lib/zoneinfo_module.o -std=c99 lib/zoneinfo_module.c:1:10: fatal error: 'Python.h' file not found #include "Python.h" ^~~~~~~~~~ 1 error generated. error: command '/usr/bin/clang' failed with exit code 1 [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for backports.zoneinfo Failed to build backports.zoneinfo ERROR: Could not build wheels for backports.zoneinfo, which is required to install pyproject.toml-based projects (venv) huzhuo@huzhuodeMacBook-Pro test %