Python version control and the use of Django,git

Source: Internet
Author: User
Tags install openssl python mysql using git virtual environment virtualenv git clone

First, install the pyenv


Install pyenv first install the RPM package environment required for Python compilation:

Yum Install ReadLine Readline-devel readline-static-y

Yum Install OpenSSL openssl-devel openssl-static-y

Yum Install Sqlite-devel-y

Yum Install Bzip2-devel bzip2-libs-y


Install Git

Yum Install git


Don't say much nonsense and start installing pyenv

git clone git://github.com/yyuu/pyenv.git ~/.pyenv

echo ' Export pyenv_root= ' $HOME/.pyenv ' >> ~/.BASHRC

echo ' Export path= ' $PYENV _root/bin: $PATH "' >> ~/.BASHRC

Echo ' eval ' $ (pyenv init-) "' >> ~/.BASHRC

EXEC $SHELL-L

Second, pyenv operation


Pyenv Install--list View installable versions

Install a Python version


Pyenv Install x.x.x

To view installed versions

Pyenv versions

* Indicates the version being used

Switch versions

Pyenv Global x.x.x

command to update the database

Pyenv Rehash

Uninstalling a version

Pyenv Uninstall x.x.x

Third, installation virtualenv


Pip Install Virtualenv

(Python can be used in the case of which version is used, and the version of the re-installed Python will need to be reinstalled virtualenv)

Create a new virtual environment

mkdir Project1

Virtualenv--distribute project1/

CD Project1

Activating and entering a virtual environment

SOURCE Bin/activate

Exiting a virtual environment

Deactivate

Iv. use of PIP


Install PIP

wget https://bootstrap.pypa.io/get-pip.py

Python get-pip.py

Note: python2.7.9 & python3.4 and its newer versions have their own PIP, no need to install separately

Update pip

Pip Install-u pip

Search Python Packages

PIP Search "Query"

Install package

Pip Install Six

To view installed packages

PIP List

V. Using GIT


Create a new warehouse

Git init

Shell commands dynamically view git status and branch

The first step is to clone the code first:

git clone git://git.kernel.org/pub/scm/git/git.git

Second Step copy Script

Copy the file Contrib/completion/git-completion.bash to the ~ and rename it to. git-completion.sh

Copy the file contrib/completion/git-prompt.sh to the ~ and rename it to. git-prompt.sh

You can take a look at the contents of these two scripts, with a brief introduction.

The third step is written. BASHRC the following content

SOURCE ~/.git-completion.sh

SOURCE ~/.git-prompt.sh

Export git_ps1_showdirtystate=1

Export git_ps1_showstashstate=1

Export Git_ps1_showuntrackedfiles=1

Export git_ps1_showupstream= "Verbose GIT svn"

Ps1= ' \[\033[1;31m\]\[email protected]\h \[\033[1;34m\]\w\[\033[1;31m\]$ (__git_ps1 "(%s)") \[\033[1;35m\], \[\ 033[0m\] '

The fourth step unregisters or restarts, at which point the command line should have changed. Success.

View git status

git status

Trace file

git Add File

Login

git config--global user.name "Wanezu"

git config--global user.email [email protected]

Submit File

Git commit-m "Commit"

Look again and you'll see that the catalog is clean.

git push

Git push-u Origin Master

Vi. Use of Githup


Create a Project login account

Create an empty Project

And then to the directory you specify (which can be a well-established program code)

CentOS will not push up.

Need to modify Vim. Git/config

Modify

[remote "origin"]

URL = https://github.com/youname/example.git

For:

[remote "origin"]

url = https://[email Protected]/youname/example.git


Vii. use of Django

Create a Django App

Django-admin Startapp Catelog


Viii. installation of Zsh

The shells are installed by default in 1.ubuntu

Cat/etc/shells

2. The version of the shell that is currently running

Echo $SHELL/bin/bash

3. Install zsh, git, and wget:

sudo apt-get install zsh git wget

4. Obtain and automatically follow Oh-my-zsh:

wget--no-check-certificate Https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh-O-| Sh

5. Replace bash for zsh:

Chsh-s/bin/zsh

6. Last reboot


Pip Install--allow-external Mysql-connector-python Mysql-connector-python


This article from "CECOTW" blog, reproduced please contact the author!

Python version control and the use of Django,git

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.