为什么80%的码农都做不了架构师?>>>
一、获取root最高权限
重启机器,然后按住command+r进入恢复模式,打开终端输入csrutil disable。再重启机器
二、安装python
2.1 下载python-3.4.2-macosx10.6.pkg,并安装
2.2 将安装的3.4.2版本的移到系统。
1、切换到root下。
2、
sudo mv /Library/Frameworks/Python.framework/Versions/3.4 /System/Library/Frameworks/Python.framework/Versions
3、
sudo chown -R root:wheel /System/Library/Frameworks/Python.framework/Versions/3.4
4、
sudo rm /usr/bin/pydocsudo rm /usr/bin/pythonsudo rm /usr/bin/pythonwsudo rm /usr/bin/python-config
5、
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.4/bin/pydoc3.4 /usr/bin/pydocsudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 /usr/bin/pythonsudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4m-config /usr/bin/python-configsudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.4/bin/pip3 /usr/bin/pip3sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.4/bin/easy_install-3.4 /usr/bin/easy_install-3.4
6、检验python
➜ / pythonPython 3.4.2 (v3.4.2:ab2c023a9432, Oct 5 2014, 20:42:22)[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwinType "help", "copyright", "credits" or "license" for more information.>>>
检验pip3
➜ / pip3 -Vpip 1.5.6 from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (python 3.4)
检验easy_install-3.4
bogon:~ root# easy_install-3.4 --helpGlobal options: --verbose (-v) run verbosely (default) --quiet (-q) run quietly (turns verbosity off) --dry-run (-n) don't actually do anything --help (-h) show detailed help message --no-user-cfg ignore pydistutils.cfg in your home directoryOptions for 'easy_install' command: --prefix installation prefix --zip-ok (-z) install package as a zipfile --multi-version (-m) make apps have to require() a version --upgrade (-U) force upgrade (searches PyPI for latest versions) --install-dir (-d) install package to DIR --script-dir (-s) install scripts to DIR --exclude-scripts (-x) Don't install scripts --always-copy (-a) Copy all needed packages to install dir --index-url (-i) base URL of Python Package Index --find-links (-f) additional URL(s) to search for packages --build-directory (-b) download/extract/build in DIR; keep the results --optimize (-O) also compile with optimization: -O1 for "python - O", -O2 for "python -OO", and -O0 to disable [default: -O0] --record filename in which to record list of installed files --always-unzip (-Z) don't install as a zipfile, no matter what --site-dirs (-S) list of directories where .pth files work --editable (-e) Install specified packages in editable form --no-deps (-N) don't install dependencies --allow-hosts (-H) pattern(s) that hostnames must match --local-snapshots-ok (-l) allow building eggs from local checkouts --version print version information and exit --no-find-links Don't load find-links defined in packages being installed --user install in user site-package '/var/root/Library/Python/3.4/lib/python/site- packages'usage: easy_install-3.4 [options] requirement_or_url ... or: easy_install-
三、elipse安装python插件
www.pydev.org/updates
勾选第一个
安装完后就多了pydev project
四、安装django
下载压缩包https://www.djangoproject.com/download/
解压后再文件夹中有setup.py
执行命令(先切换到root命令下)
4.11
#python setup.py install............省略..........Installed /System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.10.2-py3.4.eggProcessing dependencies for Django==1.10.2Finished processing dependencies for Django==1.10.2
4.12
➜ bin pythonPython 3.4.2 (v3.4.2:ab2c023a9432, Oct 5 2014, 20:42:22)[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> import django>>> django.VERSION(1, 10, 2, 'final', 0)>>>
4.13
s sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Django-1.10.2-py3.4.egg/EGG-INFO/scripts/django-admin.py /usr/bin/django-admin.py
4.2新建一个工程
#sudo django-admin.py startproject mysite
然后将myite 文件夹中的setting.py 数据的NAME改成如下所示(由于现在还没有安装sqlit数据库)
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME':'', }}
4.3 启动项目
到
#lsmanage.py mysite#./manage.py runserverPerforming system checks...System check identified no issues (0 silenced).October 08, 2016 - 16:56:36Django version 1.10.2, using settings 'yuepai.settings'Starting development server at http://127.0.0.1:8000/Quit the server with CONTROL-C.
显示效果
转:https://my.oschina.net/jywm/blog/755499
【本文由:防ddos攻击 http://www.558idc.com/gfcdn.html提供,感恩】