WIN7 +Python2.7.14 + pip + Djanggo1.9
来源:互联网 发布:战争游戏红龙 知乎 编辑:程序博客网 时间:2024/06/07 05:51
1.安装Python2.7
从官网下载2.7版,核对自己的OS系统添加相应的版本,我的版本为WIN7。
https://www.python.org/download/releases/2.7/
支持Python2.7版的最新的Django为1.11版,以后的不支持
2.安装virtualenv
使用pip命令来安装
我的Python2.7 安装在C盘,进入C:\Python27\Scripts目录下
输入:pip install virtualenv
将会自动下载:我的下载版本号为virtualenv -15.1.0-py2.py3...
3.建立虚拟环境
使用Virtualenv可以建立工程的虚拟环境。
本地仅安装了Python2.7,故创建一个目录
PS:virtualenv -help
Usage: virtualenv [OPTIONS] DEST_DIR
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-v, --verbose Increase verbosity.
-q, --quiet Decrease verbosity.
-p PYTHON_EXE, --python=PYTHON_EXE
The Python interpreter to use, e.g.,
--python=python2.5 will use the python2.5 interpreter
to create the new environment. The default is the
interpreter that virtualenv was installed with
(c:\python27\python.exe)
--clear Clear out the non-root install and start from scratch
--no-site-packages DEPRECATED. Retained only for backward compatibility.
Not having access to global site-packages is now the
default behavior.
--system-site-packages
Give the virtual environment access to the global
site-packages.
--always-copy Always copy files rather than symlinking.
--unzip-setuptools Unzip Setuptools when installing it.
--relocatable Make an EXISTING virtualenv environment relocatable.
This fixes up scripts and makes all .pth files
relative.
--no-setuptools Do not install setuptools in the new virtualenv.
--no-pip Do not install pip in the new virtualenv.
--no-wheel Do not install wheel in the new virtualenv.
--extra-search-dir=DIR
Directory to look for setuptools/pip distributions in
This option can be used multiple times.
--download Download preinstalled packages from PyPI.
--no-download, --never-download
Do not download preinstalled packages from PyPI.
--prompt=PROMPT Provides an alternative prompt prefix for this
environment.
--setuptools DEPRECATED. Retained only for backward compatibility.
This option has no effect.
--distribute DEPRECATED. Retained only for backward compatibility.
This option has no effect.
首先在D盘我创建了虚拟环境的目录。
然后继续执行命令:virtualenv D:\VirtualEnv
此目录下自动添加了
4.启动虚拟环境
进入VirtualEnv文件夹,执行Scripts下的
Scripts\activate.bat
然后命令行显示为 如下:
(VirtualEnv) D:\VirtualEnv\Scripts>
表示虚拟环境已经启动了。
5.安装 django1.9
执行 pip install django==1.9
django包就会安装到虚拟环境里。
6.生成工程目录
执行:
重新执行了一遍命令,因为文件名多拼了个字母 'r',现已更改为正确的拼写 learning_log.
7.启动服务器
在建立的工程learning_log文件下面会自动生成了manage.py文件。
cd learning_log
python manage.py migrate (注:为Django使用的一个数据库)
python manage.py runserver
在浏览器打开上述网址,显示一个初期画面的话,说明Django的初始安装完毕,可以使用。
其中 URL http://127.0.0.1:8000 即表示在本地计算机(localhost)的端口8000上侦听。localhost是一种只处理当前系统发出的请求,而不允许其他人查看你正在开发的网页的服务器
8.创建APP
在工程下建立APP Appname:learning_logs
(VirtualEnv) D:\VirtualEnv\Scripts\learning_log>python manage.py startapp learning_logs
查看文件夹下存在以下重要文件:models.py admin.py views.py 其中:models.py来定义我们在应用程序中管理的数据。
- WIN7 +Python2.7.14 + pip + Djanggo1.9
- win7,python2.7.6安装pip
- Win7 Python2.7.6 安装pip,setuptools
- Win7,64位,Python2.7.2,安装pip
- win7下python2.7安装 pip,setuptools的正确方法
- win7下python2.7安装 pip,setuptools的正确方法
- win7下python3和python2共存环境使用pip
- python2.7+pip+virtualenv
- python2.7.13安装pip
- win7的64位python2.7的pip和mysql-python安装
- win7下python2.7安装 pip,setuptools的正确方法(亲测)
- win7下python2.7安装 pip,setuptools的正确方法(亲测)
- Win7下python2和python3同时安装并解决pip共存问题
- Win7和win10下python3和python2同时安装并解决pip共存问题
- python2以及pip windows 安装
- python2.7pip安装错误
- Python2.7中安装pip
- MAC装Python2.7+pip
- android的特殊文字与Titanic的特效
- 数据结构实验之查找六:顺序查找
- 第十五周项目1
- 第二课第三周 deeplaerning.ai编程实现
- Python入门学习小记
- WIN7 +Python2.7.14 + pip + Djanggo1.9
- Spark 以及 spark streaming 核心原理及实践
- pwnable.kr
- [二维区间DP?] Atcoder ARC004E. Salvage Robots
- C语言中的堆和栈
- 字节缓冲流
- Codeforces Round #450 (Div. 2) A-C题解
- make命令工作时执行的步骤
- Qt5.9编译MQTT详细图文教程