django-admin.py startproject site_test 创建一个django项目时报错
妙龄少女为何深夜失眠!!!,只因安错django版本!!!
发现报错的时候,先看一下python的版本,再看一下Django版本是不是对应的

我的python版本是3.5,但是django版本是3.0(默认安装的最新版本),版本不匹配就一直报错
删掉原来的版本,重新安装指定版本的django就Ok啦
pip install django==2.0 -i https://pypi.mirrors.ustc.edu.cn/simple/
以下是错误的做法,记录我是如何被自己逼疯的!!!!!!!!!!!!!
报错信息
Traceback (most recent call last): File "C:\Users\MaeLi\AppData\Local\Programs\Python\Python35-32\Scripts\django-admin.py", line 5, in <module> management.execute_from_command_line() File "c:\users\maeli\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line utility.execute() File "c:\users\maeli\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "c:\users\maeli\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\__init__.py", line 244, in fetch_command klass = load_command_class(app_name, subcommand) File "c:\users\maeli\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\__init__.py", line 37, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "c:\users\maeli\appdata\local\programs\python\python35-32\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 673, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 665, in exec_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "c:\users\maeli\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\commands\startproject.py", line 1, in <module> from django.core.management.templates import TemplateCommand File "c:\users\maeli\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\templates.py", line 14, in <module> from django.core.management.utils import handle_extensions File "c:\users\maeli\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\utils.py", line 7, in <module> from django.utils.crypto import get_random_string File "c:\users\maeli\appdata\local\programs\python\python35-32\lib\site-packages\django\utils\crypto.py", line 6, in <module> import secrets ImportError: No module named 'secrets'
1、缺少模块 No module named 'secrets'
pip install secrets
又报错了,报错信息如下:
Collecting secrets Using cached secrets-1.0.2.tar.gz (7.9 kB) ERROR: Command errored out with exit status 1: command: 'c:\users\maeli\appdata\local\programs\python\python35-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MaeLi\\AppData\\Local\\Temp\\pip-install-1dg5at_9\\secrets\\setup.py'"'"'; __file__='"'"'C:\\Users\\MaeLi\\AppData\\Local\\Temp\\pip-install-1dg5at_9\\secrets\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\MaeLi\AppData\Local\Temp\pip-pip-egg-info-pncdg08s' cwd: C:\Users\MaeLi\AppData\Local\Temp\pip-install-1dg5at_9\secrets\ Complete output (12 lines): Traceback (most recent call last): File "C:\Users\MaeLi\AppData\Local\Temp\pip-install-1dg5at_9\secrets\setup.py", line 10, in <module> import OpenSSL ImportError: No module named 'OpenSSL' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\MaeLi\AppData\Local\Temp\pip-install-1dg5at_9\secrets\setup.py", line 12, in <module> raise ImportError('Installing this module requires OpenSSL python bindings') ImportError: Installing this module requires OpenSSL python bindings ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
2、No module named 'OpenSSL'
pip install pyOpenSSL -i https://pypi.mirrors.ustc.edu.cn/simple/
3、执行 pip install secrets 又报错了。 安装pip3 install wheel -i https://pypi.mirrors.ustc.edu.cn/simple/
Could not build wheels for secrets, since package 'wheel' is not installed. Could not build wheels for configobj, since package 'wheel' is not installed. Could not build wheels for python-ldap, since package 'wheel' is not installed. Could not build wheels for six, since package 'wheel' is not installed. Could not build wheels for pyasn1, since package 'wheel' is not installed. Could not build wheels for pyasn1-modules, since package 'wheel' is not installed. Could not build wheels for future, since package 'wheel' is not installed. Installing collected packages: python-ldap, future, systematic, python-gnupg, secrets Running setup.py install for python-ldap ... error ERROR: Command errored out with exit status 1: command: 'c:\users\maeli\appdata\local\programs\python\python35-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MaeLi\\AppData\\Local\\Temp\\pip-install-_uybrweh\\python-ldap\\setup.py'"'"'; __file__='"'"'C:\\Users\\MaeLi\\AppData\\Local\\Temp\\pip-install-_uybrweh\\python-ldap\\setup.py'"
4、还是报错,我要疯了!!!!!!!!!!!!!!
Running setup.py install for python-ldap ... error ERROR: Command errored out with exit status 1: command: 'c:\users\maeli\appdata\local\programs\python\python35-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MaeLi\\AppData\\Local\\Temp\\pip-install-1m4uo2e0\\python-ldap\\setup.py'"'"'; __file__='"'"'C:\\Users\\MaeLi\\AppData\\Local\\Temp\\pip-install-1m4uo2e0\\python-ldap\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\MaeLi\AppData\Local\Temp\pip-record-l32b2w3f\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\maeli\appdata\local\programs\python\python35-32\Include\python-ldap' cwd: C:\Users\MaeLi\AppData\Local\Temp\pip-install-1m4uo2e0\python-ldap\ Complete output (74 lines):

浙公网安备 33010602011771号