This article mainly introduces some CentOS Python production environment Deployment command, very good, with reference value, need to refer to the friend
Just notes
After getting a clean CentOS, initialize the Python environment with some commands and problem logs.
Can be made into scripts to initialize automatically, of course, with Docker better
Basic Environment
1. Create a user
sudo adduser newusersudo passwd newuser# setting authorization does not require a password to be entered Sudo/usr/sbin/visudonewuser All=nopasswd:all
2. EPEL (Fedora Extra Packages for Enterprise Linux repository)
Reference documents
wget Http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpmsudo RPM-UVH epel-release-6*.rpm
3. Add Ius source
Package Address
wget Http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-13.ius.centos6.noarch.rpmsudo rpm -UVH ius-release-1.0-13.ius.centos6.noarch.rpm
4. Installing PYTHON2.7/PYTHON3/PIP
sudo yum install python27sudo yum install Python27-develthencurl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ ez_setup.py | sudo/usr/bin/python2.7-# Pipcurl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | Sudo/usr/bin/python2.7-extra:install python3sudo Yum Install python34u python34u-devel
5. Virtualenv
sudo pip install virtualenv
6. Gen SSH key
Ssh-keygen-t Rsaadd ~/.ssh/id_rsa.pub to git or github
Some services
1. Install git
sudo yum install git
2. mysql
sudo yum install mysqlsudo yum install mysql-devel*-ysudo yum install mysql-serversudo/sbin/service mysqld start
3. Redis
sudo yum install redis
4. RABBITMQ
sudo yum install rabbitmq-server
Problem
[Errno 14] Peer cert cannot be verified or peer cert invalid
Add "Sslverify=false" in/etc/yum.conf
Pip error:ImportError:cannot Import Name Httpshandler
yum install openssl openssl-devel -y
See in SOF
Mysql-python
_mysql.c:2642:error:initializer element is not constant
_mysql.c:2642:error: (Near initialization for ' _mysql_resultobject_memberlist[0].offset ')
_mysql.c:in function ' _mysql_connectionobject_getattr ':
_mysql.c:2666:error: ' _mysql_connectionobject ' has no member named ' Open '
Error:command ' gcc ' failed with exit status 1
----------------------------------------
Command "/data/home/alarm/env/bin/python-c" Import setuptools, tokenize;__file__= '/tmp/pip-build-hgxaqt/ Mysql-python/setup.py '; Exec (Compile (getattr (tokenize, ' open ', open) (__file__). Read (). replace (' \ r \ n ', ' \ n '), __file __, ' exec ')) "Install--record/tmp/pip-kx2csu-record/install-record.txt--single-version-externally-managed-- Compile "failed with error code 1 In/tmp/pip-build-hgxaqt/mysql-python
Processing:yum install mysql-devel