[python3 environment to build itself centosyum also py2.x underlying implementation, installation 3.x time to implement multiple versions co-exist to solve these problems here]
Installation compiler environment
# yum groupinstall -Y 'Development Tools'
# yum the install -Y-devel zlib bzip2-devel-devel ncurese OpenSSL-devel
Download py3.7.3 [version number https://www.python.org can go there to look for, you can change the path]
wget https://www.python.org/ftp/python/3.7.3/Python-3.7 .3.tar.xz
3. Compile install
unzip the xz:
# Python-3.7.3.tar.xz the xz -d
Extracting tar:
# tar xvf Python-3.7.3.tar
Switch to the source directory:
# the Python-3.7.3 CD /
编译、安装:
yum install libffi-devel -y【缺少这部:ModuleNotFoundError: No module named '_ctypes'】
# ./configure && make && make install
zipimport.ZipImportError: can't decompress data
# yum -y install zlib*
4. Create a soft link Python3
# rm -f / usr / bin / python; ln -s / usr / local / bin / python3 / usr / bin / python
5. View the Python version
# python --version
安装gcc/g++/gdb
yum install gcc
yum install gcc-c++
yum install gdb
Check whether the installation successfully installed [path] will appear
Which gcc
Which G ++
Which gdb
Py in a multi-version environment, is set as the default version python3.x
view the path of Python in / usr / bin below. Python can see links is python 2.7, so run python 2.7 is equivalent to execute python
[root @ VM_181_254_centos Python-3.6.1] # LS -al / usr / bin | grep python
lrwxrwxrwx 1 root root 7 Jun 2 14: python.bak 10 -> python2
lrwxrwxrwx the root. 1 2 14:10 python2 the root On Jun. 9 -> python2.7
-rwxr XR-7136-X-Nov. 1 the root the root. 6 2016 python2.7
The soft link the original python rename
# mv / usr / bin / python /usr/bin/python.bak
The python link to python3
# LN -s / usr / local / bin / python3 / usr / bin / python
At this time, and then view the version of Python
# -V Python
Python 3.6.1
#配置yum
# vi yum-config-manager
# vi /usr/bin/yum
# Vi / usr / libexec / urlgrabber -ext-down # installation docker use
vim / usr / bin / firewall- cmd # firewall rules
inside the python modifications to the current python2.x
For vim does not have permission to modify this command:
w sudo TEE%!
python commonly used library is installed
PIP install Requests
PIP install the Selenium # automated testing tools
pip install aiohttp # provides asynchronous web services library
pip install lxml # parser library html / xml support xpath analytical methods
pip install beautifulsoup4 # parse xml / html extract data from web pages
pip install pyquery # and jQuery to provide similar support parsing html css selectors
pip install Flask # lightweight web services framework
pip install tirnado # supports asynchronous web frameworks
pip install mitmproxy # supports http, https packet capture framework
pip install pyspider # reptile framework
pip install scrapyrt # http interface to provide scheduling, do not need to perform scrapy command, but http request to schedule scrapy task
pip install gerapy #gerapy is a distributed management module scrapy
多版本下安装pyspider出现{
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "/tmp/pip-install-55pos95o/pycurl/setup.py", line 229, in configure_unix
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/usr/local/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "/usr/local/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'curl-config': 'curl-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-55pos95o/pycurl/setup.py", line 944, in <module>
ext = get_extension(sys.argv, split_extension_source=split_extension_source)
File "/tmp/pip-install-55pos95o/pycurl/setup.py", line 606, in get_extension
ext_config = ExtensionConfiguration(argv)
File "/tmp/pip-install-55pos95o/pycurl/setup.py", line 101, in __init__
self.configure()
File "/tmp/pip-install-55pos95o/pycurl/setup.py", line 233, in configure_unix
raise ConfigurationError(msg)
__main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory: 'curl-config': 'curl-config'
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-55pos95o/pycurl/
}
解决方法yum install curl-devel,再次pip install pyspider
Install MySQL:
# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install -y mysql mysql-server
# systemctl start mysqld #启动mysql
# Systemctl stop mysqld # stop mysql
# # syustemctl restart mysqld restart mysql
mysql -uroot -p
password to log mysql, in fact, there will complain [I want to use mongod, nosql type more suitable for the majority of the background]
{
pause mysql: systemctl stop mysqld
ignores check permissions ways to start: mysqld --skip-grant-tables &
it should be this: mysqld --user = root --skip-grant -tables &
connection mysql again: mysql -uroot
update account password:
mysql5.7 the following versions: uPDATE mysql.user SET password = pASSWORD ( '123456') where = the USER 'root';
mysql5.7 version: UPDATE mysql.user SET authentication_string = pASSWORD ( '123456') where USER = 'root';
refresh permissions: flush privileges;
quit mysql: exit or quit
MySQL-uroot--p
password : 123456
}
fro m flask import Flask
app = Flask(__name__)
app.route @ ( "/")
DEF the Hello ():
return "the Hello World!"
IF __name__ == "__main__":
app.run ()
http://120.79.180.109:5000/
# 5000 port to run the web service
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.wirte("Hello World!")
def make_app():
return tornado.web.Application([(r"/",MainHandler),])
__name__ == IF "__main__":
App = make_app ()
app.listen (8888)
. tornado.ioloop.IOLoop.current () Start ()
http://120.79.180.109:8888/
# 8888 Port in running web services
1. Installation httpd
command: yum -y install httpd
2. Set the boot automatically start
command: chkconfig httpd on
attention, CentOS7 use the command "systemctl enable httpd", and CentOS6 command "chkconfig httpd on",
3. Start apache server
command: service httpd start
note, CentOS7 use the command "systemctl start httpd", and CentOS6 command "service httpd start".