博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mac 安装python3.4、django
阅读量:6901 次
发布时间:2019-06-27

本文共 4870 字,大约阅读时间需要 16 分钟。

  hot3.png

一、获取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

      225507_Dlvu_2318885.png

勾选第一个

225902_3MfD_2318885.png

安装完后就多了pydev project

225937_5yrW_2318885.png

 

四、安装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.

显示效果

005708_oxUi_2318885.png

 

转载于:https://my.oschina.net/jywm/blog/755499

你可能感兴趣的文章
snakemake--我最喜欢的流程管理工具
查看>>
如何用 Python 和 gensim 调用中文词嵌入预训练模型?
查看>>
nginx三种安装方式
查看>>
陷阱:千万不要随便把serlvet.jar之类的包放在系统的classpath下面
查看>>
K8S有状态服务-云盘扩容解决方案
查看>>
Java8集合源码解析-Hashtable源码剖析
查看>>
飘刃 v0.0.10 首次发布,超快执行速度的 Vue 项目构建工具
查看>>
用5分钟熟悉3种经典排序算法,浅显易懂!
查看>>
ssh服务介绍
查看>>
微信分享链接,JS-SDK应用
查看>>
NSQL数据库的5种经典
查看>>
阿里云授权服务中心解答阿里云备案相关疑问
查看>>
一些收集的MikroTik RouterOS破解版虚拟机VMware
查看>>
wordpress无法更新为最新版本
查看>>
爬虫代码编写中会遇到的字符处理的坑
查看>>
SSM-Spring-09:Spring中jdk动态代理
查看>>
我为NET狂官方面试题-数据库篇
查看>>
HBase集群安装
查看>>
Ubuntu终端字体大小设置快捷键
查看>>
[20180625]函数与标量子查询13(补充)
查看>>