[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

 

posted @   Zhentiw  阅读(235)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2016-03-01 [Immutable.js] Working with Subsets of an Immutable.js Map()
2016-03-01 [Immutable,js] Iterating Over an Immutable.js Map()
2016-03-01 [Hapi.js] Managing State with Cookies
2016-03-01 [Hapi.js] Request Validation with Joi
2015-03-01 [Bootstrap] 3. Responsive Gridding (.hidden-sm, visible-md)
点击右上角即可分享
微信分享提示