[Django] Get started with Django -- Install python and virtualenv
Install python3 on MacOS:
brew install python3
Come alone with python3, there are also some other tools are installed as well, for examlpe: 'pip, setuptools'...
We need 'pip' to help us install virtualenv.
Why virtualenv?
Main reason is to resolve the libaraies conflict for different django project. So for each project, you should create new virtual env, and install libraries only for this project, NEVER globally!
Install:
pip3 install virtualenv
Before create a new virtual env, we need to check the python3 location:
which python3
And in my case, it is:
/usr/local/bin/python3
Create new virtual env:
virtualenv -p /usr/local/bin/python3 myFirstProject
Go to the env folder we just create and start working on this env:
cd myFirstProject
. bin/activate
Now we are in the virtual env, we can start install django:
pip install django
To make sure and get familiar where those libraries are installed, we can go to:
ls lib/python3.6/site-packages
And you should be able to find django is there.
And also you can type:
python // type paython >>> import django // import django lib >>> django.VERSION // see the verison (1, 10, 5, 'final', 0) // prints out
Other way to create new env with >python3.3 only:
python3 -m venv demo
Deactive you env:
deactivate
List all the libararies:
pip list
相关文章
- 【Python成长之路】python 基础篇 -- global/nonlocal关键字使用
- 【Python成长之路】python 基础篇 -- 装饰器【华为云分享】
- Django 1.6 最佳实践: django项目的服务器自动化部署(转)
- Django中如何使用django-celery完成异步任务2(转)
- python后端面试第四部分:django框架--长期维护
- python解决json序列化时间格式
- python: 安装DeOldify库:黑白图片上色(Python 3.7.15)
- Docker如何部署Python项目
- 【Python五篇慢慢弹】数据结构看python
- Python使用设计模式中的责任链模式与迭代器模式的示例
- Python的Django REST框架中的序列化及请求和返回
- python django model定义
- Python Django通过牵引文件查看建表sql语句的命令sqlmigrate
- 三十岁了,从零开始学python还有前途吗?
- Python语言学习:利用python语言实现调用内部命令(python调用Shell脚本)—命令提示符cmd的几种方法
- Python编程语言学习:包导入和模块搜索路径(包路径)简介、使用方法(python系统环境路径的查询与添加)之详细攻略
- Python的IDE:基于Eclipse/MyEclipse软件的PyDev插件配置python的开发环境(不同python项目加载不同版本的python)—从而实现Python编程图文教程之详细攻略
- python --> Python初阶 --> 基础语法 --> 条件和分支
- 【Python成长之路】python 基础篇 -- 装饰器【华为云分享】
- 【阶段二】Python数据分析Pandas工具使用10篇:探索性数据分析:数据的检验:正态性检验
- Python Django框架学习05:Django 模板
- python 中的__del__
- 【华为机试真题 Python实现】字符串格式化输出【2022 Q1 Q2 |100分】
- python编程:linux环境gunicorn+nginx部署django项目
- python 元类metaclass
- python基础===jieba模块,Python 中文分词组件
- 〖Python语法进阶篇①〗- 进程与多进程概述
- 【Python】3.python实现图片上传到阿里云OSS
- python库Django链接mysql数据库做网站(二)--从网页向数据库中插入数据
- Python .py 文件打包成 .exe 文件(Windows平台,python 3.x)