django 2 by example环境

使用虚拟环境:

1
haotianfei@tianfei-opensuse:~/pyproject> sudo pip3 install virtualenv

指定python版本为3.6

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
haotianfei@tianfei-opensuse:~/pyproject> virtualenv --python=python3.6 django2byExample
Running virtualenv with interpreter /usr/bin/python3.6
Using base prefix '/usr'
New python executable in /home/haotianfei/pyproject/django2byExample/bin/python3.6
Also creating executable in /home/haotianfei/pyproject/django2byExample/bin/python
Installing setuptools, pip, wheel...
done.
haotianfei@tianfei-opensuse:~/pyproject/django2byExample/bin> source ~/pyproject/django2byExample/bin/activate
(django2byExample) haotianfei@tianfei-opensuse:~/pyproject/django2byExample/bin>

(django2byExample) haotianfei@tianfei-opensuse:~/pyproject/django2byExample/bin> sudo pip3 install virtualenvwrapper
haotianfei@tianfei-opensuse:~/github/tianfei/talenhao.github.io.hexo> export WORKON_HOME=~/.virtualenvs/
haotianfei@tianfei-opensuse:~/github/tianfei/talenhao.github.io.hexo> export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.6
haotianfei@tianfei-opensuse:~/github/tianfei/talenhao.github.io.hexo> virtualenvwrapper.sh
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/premkproject
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/postmkproject
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/initialize
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/premkvirtualenv
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/postmkvirtualenv
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/prermvirtualenv
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/postrmvirtualenv
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/predeactivate
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/postdeactivate
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/preactivate
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/postactivate
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/get_env_details

或使用virtualenvwrapper

1
2
3
4
5
6
7
8
9
10
11
12
haotianfei@tianfei-opensuse:~> mkvirtualenv django2byExample
Using base prefix '/usr'
New python executable in /home/haotianfei/.virtualenvs/django2byExample/bin/python3
Also creating executable in /home/haotianfei/.virtualenvs/django2byExample/bin/python
Installing setuptools, pip, wheel...
done.
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/django2byExample/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/django2byExample/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/django2byExample/bin/preactivate
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/django2byExample/bin/postactivate
virtualenvwrapper.user_scripts creating /home/haotianfei/.virtualenvs/django2byExample/bin/get_env_details
(django2byExample) haotianfei@tianfei-opensuse:~> workon django2byExample

安装django

1
2
3
4
5
6
7
8
9
10
(django2byExample) haotianfei@tianfei-opensuse:~> pip install django==2.0.5
(django2byExample) haotianfei@tianfei-opensuse:~> lssitepackages
django easy_install.py pip-18.1.dist-info __pycache__ pytz-2018.9.dist-info setuptools-40.6.3.dist-info wheel-0.32.3.dist-info
Django-2.0.5.dist-info pip pkg_resources pytz setuptools wheel
(django2byExample) haotianfei@tianfei-opensuse:~> python
Python 3.6.5 (default, Mar 31 2018, 19:45:04) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.__version__
'2.0.5'
坚持原创技术分享,您的支持将鼓励我继续创作!