Setup Python and Django Environment in Fedora 17


1. Install Dependency Packages

1
2
3
4
sudo yum update
sudo yum install alacarte git wget vim lsb
sudo yum install make automake gcc gcc-c++ kernel-devel
sudo yum install python-devel libevent-devel python-pip bash-completion

2. Setup MySQL

1
sudo yum install mysql mysql-server mysql-devel

Run MySQL at startup :

1
2
sudo systemctl start mysqld.service
sudo systemctl enable mysqld.service

3. Install Virtualenv and Virtualenvwrapper

1
2
sudo pip-python install virtualenv
sudo pip-python install virtualenvwrapper

Load virtualenv into our bash by add this into ~/.bashrc :

1
2
3
4
export WORKON_HOME=$HOME/.virtualenvs
source /usr/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=$WORKON_HOME # Tell pip to create its virtualenvs in $WORKON_HOME.
export PIP_RESPECT_VIRTUALENV=true # Tell pip to automatically use the currently active virtualenv

And load this with “source ~/.bashrc”. Then we can start create a new virtualenv called “trip” for example, by :

1
mkvirtualenv –no-site-packages –distribute trip

And it will show you the result :

1
2
3
4
5
6
7
8
9
The –no-site-packages flag is deprecated; it is now the default behavior.
New python executable in trip/bin/python
Installing distribute………………………………………………………………………………………………………………………………………………………………………….done.
Installing pip…………….done.
virtualenvwrapper.user_scripts creating /home/fedora/.virtualenvs/trip/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/fedora/.virtualenvs/trip/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/fedora/.virtualenvs/trip/bin/preactivate
virtualenvwrapper.user_scripts creating /home/fedora/.virtualenvs/trip/bin/postactivate
virtualenvwrapper.user_scripts creating /home/fedora/.virtualenvs/trip/bin/get_env_details

4. Install Python Module
Create python-module.txt that contain :

1
2
3
4
5
ipdb
ipython
MySQL-Python
pylint
pep8
1
sudo pip install -r python-module.txt

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.