rhel7 and Django installation Python3.4

1, the official website to download the installation package:

          wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz

2, the decompressed mounted tar -xf Python-3.4.3.tar.xz after win 

                                                    cd Python-3.4.3 /

                                                    ./configure --prefix=/usr/local/python/python3 --with-openssl

                                                     make && make install

                                                      yum install sqlite-devel -y

    ./configure command to create a file after finished creating Makefile, make for the top of the order after running make install will use the process
sequence is installed into the specified directory.
Configure is an executable script, it has a lot of options, --prefix option is to configure the installation path if you do not configure this option

After the installation executable file in the default / usr / local / bin, the default library file in / usr / local / lib, the default configuration file in / usr / local / etc, other resource files in / usr / local / share. If you configure --prefix such as:

       ./configure --prefix = / usr / local / test can put all the resources files in / usr / local / test path, not messy. Another benefit of using the -prefix option is to uninstall the software or software migration. When a software installation is no longer required, just simply delete the installation directory, you can uninstall the software was clean; porting software to simply copy the entire directory to another machine (same operating system).

3, after compiling the installation is complete, modify the soft link python named, el7 comes with a python2.7.5 ####### ignored if used directly in front of python2

     Delete the original soft link rm -rf / usr / bin / python

     Create a new soft link ln -s /usr/local/python/python3/bin/python3.4 / usr / bin / python

     View version

 

     4, was replaced after python3.4 yum may not be available   

      This is to enter the yum configuration file, the first line #! / Usr / bin / python into a #! / Usr / bin / python2.7 can

      After modifying the command yum repolist execute the following error appears 

        As before, because yum uses Python as a command interpreter, vim / usr / libexec / urlgrabber-ext-down to #! / Usr / bin / python into a #! / Usr / bin / python2.7

5, the installation django

       and the corresponding python django version, select a supported version installed django, I used python2.7 + django1.9

 

Django also need to install setuptools and pip

Pip is a tool to install and manage Python packages, is easy_install alternatives, look for Python provides a package, download, install, uninstall function.

is a collection of Python distutils setuptools enhanced version, it can help us more easily create and distribute Python packages, especially those with dependencies. When users create a package using setuptools, it does not require the installed setuptools, as long as a module to start

Download setuptools; unzip

                     wget --no-check-certificate  https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz

                      tar -xf setuptools-19.6.tar.gz

Compiled and installed; cd setuptools-19.6 /

                    python  setup.py  build
                    python  setup.py  install                   

                   setup.py, it is used to install the module

With pip command to install django, can develop an installation version (host needs to have a network, the equivalent of pypi downloaded from the server cloud)

                     pip install django==1.9

    It has been installed

Enter python, django view after import

         django2.1 installation:

pip install django

vim ~/.bash_profile

source ~/.bash_profile

PATH=$PATH:$HOME/bin:/usr/local/python3/bin

发布了9 篇原创文章 · 获赞 459 · 访问量 16万+

Guess you like

Origin blog.csdn.net/songhait/article/details/96157016