天天看點

python之路-----搭建django架構

1、在yaolansvr 192.168.0.3上安裝Python-3.4.3.tar.xz

使用Xmanager5的Xftp5将檔案上傳到ftp目錄

2、安裝源碼的python

注意:

(1)Ignoring ensurepip failure: pip 6.0.8 requires SSL/TLS

解決:需要安裝yum -y install openssl-devel.x86_64

# yum list all|grep glibc

glibc.x86_64                              2.12-1.149.el6                   @base

glibc-common.x86_64                       2.12-1.149.el6                   @base

glibc-devel.x86_64                        2.12-1.149.el6                   @base

glibc-headers.x86_64                      2.12-1.149.el6                   @base

compat-glibc.x86_64                       1:2.5-46.2                       base 

compat-glibc-headers.x86_64               1:2.5-46.2                       base 

glibc.i686                                2.12-1.47.el6                    base 

glibc-devel.i686                          2.12-1.47.el6                    base 

glibc-static.i686                         2.12-1.47.el6                    base 

glibc-static.x86_64                       2.12-1.47.el6                    base 

glibc-utils.x86_64                        2.12-1.47.el6                    base 

# rpm -qa|grep glibc

glibc-common-2.12-1.149.el6.x86_64

glibc-2.12-1.149.el6.x86_64

glibc-headers-2.12-1.149.el6.x86_64

glibc-devel-2.12-1.149.el6.x86_64

# yum list all|grep openssl

openssl.x86_64                            1.0.1e-30.el6                    @base

krb5-pkinit-openssl.x86_64                1.9-22.el6                       base 

openssl.i686                              1.0.0-20.el6                     base 

openssl-devel.i686                        1.0.0-20.el6                     base 

openssl-devel.x86_64                      1.0.0-20.el6                     base 

openssl-perl.x86_64                       1.0.0-20.el6                     base 

openssl-static.x86_64                     1.0.0-20.el6                     base 

openssl098e.i686                          0.9.8e-17.el6.centos             base 

openssl098e.x86_64                        0.9.8e-17.el6.centos             base 

# rpm -qa|grep openssl

openssl-1.0.1e-30.el6.x86_64

(2)make install錯誤

make可以,而make install不行,是因為make一般指進行源碼的編譯和連結,生成可執行檔案,make install是将編譯好的程式複制到實作部署的目錄結構中;

解決:如果安裝的時候指定了prefix,直接删除就好。如果沒有,并且源代碼沒有提供make uninstall/distclean/veryclean的功能,一般這樣做:找一個臨時目錄重新安裝一遍。

比如./configure --prefix=/tmp/to_remove && make install然後周遊/tmp/to_remove裡的檔案,把你原來安裝位置的檔案都删除。

mount /dev/cdrom /mnt

yum makecache --disablerepo=epel ##最好修改.repo檔案關閉

yum install readline-devel -y

yum -y install xz.x86_64 

cd /yangsq/ftp/

xz -d Python-3.4.3.tar.xz

tar xvf Python-3.4.3.tar

yum -y install openssl-devel.x86_64 ##pip必須需要這個依賴包,2.x不需要

./configure --prefix=/usr/local/python3.4.3  ##Makefile在這個步驟建立

make&&make install

Successfully installed pip-6.0.8 setuptools-12.0.5

ln -sv /usr/local/python3.4.3/bin/python3.4 /usr/bin/python3.4

3、使用pip安裝django(Installing an official release with pip)

/usr/local/python3.4.3/bin/pip3.4 install django

Successfully installed django-1.8.3

4、驗證是否成功安裝django

pwd

/usr/local/python3.4.3/bin

ll *django*

-rwxr-xr-x. 1 root root 286 8月  18 17:11 django-admin

-rwxr-xr-x. 1 root root 145 8月  18 17:11 django-admin.py

python3.4

>>> import django

>>> django.VERSION

(1, 8, 3, 'final', 0)