Python MySQLdb Installation notes in Linux, pythonmysqldb
Once in a windows environment at homeSee python MySQLdb quick installation and troubleshooting in windows.Http://www.bkjia.com/article/65746.htm
In the company's development needs, another time, under linux.I found that it was really painful to install it by compiling, but it was just a matter of time and
Sometimes it is necessary to invoke the shell command directly to complete some simple operations, such as mount a file system. So how do we use Python to invoke the Linux shell command? Here are a few common ways to do this:1. OS module1.1. The Exec method family of the OS moduleThe exec system method of Python is consistent with the UNIX exec system call. These
It took some time these days to deploy the Django-developed Web project to Apache, referencing some official documents and documents on the Internet, or spending more time on the configuration process.
Convenient to have the need of friends, can refer to, less detours!
1. Django Project Deployment Environment descriptionOperating system: Red Hat Enterprise Linux Server Release 5.3 (Tikanga) x86_64
Apache Version: Httpd-2.2.3-22.el5
Mod_wsgi version:
The Python dictionary is very useful. during a long period of use, we will find that it has a wide range of applications and strong adaptability. Next, let's take a look at a dictionary program that can be run in linux on the internet yesterday and share it with you. The Python dictionary is actually a good language.
#!/usr/bin/
will exist here.Write the following procedure:#!/usr/bin/env python#coding: Utf-8 fromEvdevImportInputDevice fromSelectImportSelect def detectinputkey():dev = InputDevice ('/dev/input/event4 ') while True: select ([Dev], [], []) forEventinchDev.read ():Print "code:%s value:%s"% (Event.code, Event.value)if__name__ = =' __main__ ': Detectinputkey ()The role of select is to wait for Dev to change before running the subsequent code, Dev.read () returns t
This article describes how to use python to monitor apache server processes in linux. for details, refer to crtrl. py to monitor the Python scripts of Apache server processes.
The code is as follows:
! /Usr/bin/env PythonImport OS, sys, time
While True:Time. sleep (4)Try:Ret = OS. popen ('PS-C apache-o pid, cmd'). readlines ()If len (ret) Print "The apach
Open a Web browser to access http://www.python.org/download/
Select the source compression package for unix/linux.
Download and unzip the zip package.
If you need to customize some options to modify modules/setup
execute the./configure Script
Make
Make install
After doing this, Python is installed in the/usr/local/bin directory, and the Python
Python debugging in Linux
Python has its own pdb library for simple debugging. The basic commands are similar to gdb, but the functions are not as powerful as gdb. pdb mainly supports multi-breakpoint settings (conditional settings ), code-level single-step debugging, viewing stack information, code viewing, post-mortem debugging,
For more information, see: http:
First, find the directory/usr/local/apache2/conf to install Apache, and modify the httpd.conf configuration file.1. Loading the CGI moduleRemove Comments:LoadModulecgid_modulemodules/mod_cgid.so #//当使用内置模块prefork.c时动态加载cgi_moduleLoadModule cgi_module modules/mod_cgi.so #当使用内置模块worker. C Dynamic Load Cgid_module2. Set the CGI script file pathScriptAlias/cgi-bin/" /var/www/cgi-bin/"3. Set access permissions for CGI paths"/var/www/cgi-bin"> allowoverride None Options +execcgi Order Allow, Den
Python is usually installed in/usr/local/python3 (a specific installation location to see a person's preference, but to remember the location of the installation), because the/usr/local directory does not exist in the directory Python3, so first create a new directory:mkdir /usr/local/python31. Download Python3 from official websitehttps://www.python.org/downloads/2. Install dependent environmentThe installation of Python3 requires these four dependen
Under Windows System, you can install it simply by entering the command PIP install requests.
Under Linux, you only need to enter the command sudo pip install requests to install.
Or
=================
Window
1. Download requests by Wall
Open this URL, http://www.lfd.uci.edu/~gohlke/pythonlibs on this site has a lot of Python third-party library files, ctrl+f find requests download
After downloading t
First, using Init1, the system has a corresponding Python interpreter, and in the script header declaration, for example:#!/usr/bin/python+x somescript.pyStart this command format to launch the program4. Place the script under the/etc/rc.d/init.d/path--add somescript.py Add Service3 somescript.py on Boot the service on Init 3 or 5 levelWhen running Chkconfig, the program will error and need to include in th
Linux system uses Python to get CPU information script sharing
Copy Code code as follows:
#!/usr/bin/env Python
From __future__ import print_function
From collections Import Ordereddict
Import Pprint
Def CPUinfo ():"" Return the information In/proc/cpuinfoAs a dictionary in the following format:cpu_info[' proc0 ']={...}cpu_info[' Proc1 ']={...
breakpoint is invalidated. Enable Failure 10th BreakpointEnable [Bpnumber[bpnumber]]: Enables the first NUM breakpoint, enabling 10. Enable 10th BreakpointW (where): Print stack informationA (args): Print current function parameter informationOf course we can also use the PDB library function to implement the debug of the py:For Example: we can use the PDB function: Set_trace ()def func (num): s = num * return sif __name__ = = ' __main__ ': print ' Debug starting ... ' print ' * ' *
Python implements the find command instance sharing in Linux, pythonfind
Use Python to implement the find command in Linux
The Code is as follows:
#! /Usr/bin/python # *-* coding: utf8 *-* from optparse import OptionParserimport osimport sys # use the option help information
Install third-party libraries for different python versions in Linux.
Problem background
Currently, many python versions are installed on linux distributions.
The default version on my machine is python 2.x. When easy_install is used to install third-party libraries, it i
Linux transcoding command line and python implementation, linuxpythonThe file copied from windows to linux is garbled today.File, iconvCommand transcoding is enough./* If it is implemented through a command line, it is also possible, and to some extent it may be more convenient */File genghao. cpp/* You can find the approximate encoding type of this file */Iconv-
Python Linux signal programming signals, pythonsignals1. Signal Introduction
The Soft Interrupt signal (signal) is used to notify the process of an asynchronous event. Processes can call kill to send Soft Interrupt signals to each other. The kernel can also send a signal to the process due to internal events to notify the process of an event. Note that the signal is only used to notify a process of events
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.