1 创建虚拟环境 virtualenv
- --安装# pip intall virtualenv
2 --- 进入要创建虚拟环境目录下:
# cd :d #cd virtualenvs
3 ----创建虚拟环境,创建【环境名称】文件夹,放置所有环境变量
# virtualenv 项目名称 --python=Python3.6
--python=Python27.exe
--python='C:PythonPython36python.exe
4 ---激活虚拟环境和退出虚拟环境
# 进入 虚拟环境目录: cd trace
# 进入 scripts目录 :cd scripts
# activate
5 出现(项目名称):的标准就是表示激活成功
----虚拟环境安装django
python3.7 和django1.11.7 不兼容 .可以安装 django.1.11.28
6 执行: pip install django==1.11.7
----搭建django环境
提醒:先去创建虚拟环境
7 创建django项目
django-admin startproject applet
8 创建 app
cd applet
python manage.py startappp myapp
注意事项: 在创建APP可能出现
解决办法:修改指定路径下的functools.py文件的def total_ordering(cls):方法:
原来的样子:
convert = {
'__lt__': [('__gt__', lambda self, other: other < self),
('__le__', lambda self, other: not other < self),
('__ge__', lambda self, other: not self < other)],
'__le__': [('__ge__', lambda self, other: other <= self),
('__lt__', lambda self, other: not other <= self),
('__gt__', lambda self, other: not self <= other)],
'__gt__': [('__lt__', lambda self, other: other > self),
('__ge__', lambda self, other: not other > self),
('__le__', lambda self, other: not self > other)],
'__ge__': [('__le__', lambda self, other: other >= self),
('__gt__', lambda self, other: not other >= self),
('__lt__', lambda self, other: not self >= other)]
}
修改后的样子:
convert = {
'__lt__': [('__gt__', lambda self, other: not (self < other or self == other)),
('__le__', lambda self, other: self < other or self == other),
('__ge__', lambda self, other: not self < other)],
'__le__': [('__ge__', lambda self, other: not self <= other or self == other),
('__lt__', lambda self, other: self <= other and not self == other),
('__gt__', lambda self, other: not self <= other)],
'__gt__': [('__lt__', lambda self, other: not (self > other or self == other)),
('__ge__', lambda self, other: self > other or self == other),
('__le__', lambda self, other: not self > other)],
'__ge__': [('__le__', lambda self, other: (not self >= other) or self == other),
('__gt__', lambda self, other: self >= other and not self == other),
('__lt__', lambda self, other: not self >= other)]
}
改完之后即可创建app