python 安装
----------linux-----------------------
第一种基本安装方法
1 下载包,解压
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
tar zxvf Python-2.7.12.tgz
2 cd Python-2.7.12
3
./configure --prefix=/usr/local/python
make
make install
看到包内的文件在安装即可……
centos6 替换系统自带Python
1.#备份旧Python 到 python2.6
mv /usr/bin/python /usr/bin/python2.6
2.#建立软连接
ln -sf /usr/local/python/bin/python2.7 /usr/bin/python
3.修正yum
#文件开头的第一行代码的Python解析器修改为:#!/usr/bin/python2.6
vi /usr/bin/yum
#安装python-setuptools
Ubuntu
>apt-get install python-setuptools
# 安装pip
>easy_install pip
>pip install pyftpdlib
centOS
>yum install python-setuptools
windows
下载 --
#安装pytest模块
>easy_install pytest
#安装requests模块
>easy_install requests
#安装pip模块
>easy_install pip
#安装 yaml
>pip install PyYaml
# 查询是否安装 MySQL数据库
>which mysql
(1)Centos7中用MariaDB代替了mysql数据库,安装使用mariadb
(2)CentOS7的yum源中默认好像是没有mysql的
1. 下载mysql的repo源
$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2. 安装源包,会获得两个mysql的yum repo源:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo。
$ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
3. 安装mysql
$ sudo yum install mysql-server
#把/var/lib/mysql的拥有者改为当前用户:
chown -R root:root /var/lib/mysql
# 重启服务
>service mysqld restart
>mysql -u root
mysql>use mysql;
mysql>update user set password=password('123456') where user = 'root';
mysql>exit;
-----------------------------windows----------------------------------------------------------------------------------------------------
1 下载包,解压
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
tar zxvf Python-2.7.12.tgz
2 cd Python-2.7.12
3 输入python setup.py build
4 输入python setup.py install
看到包内的文件在安装即可……
下载安装python安装工具 http://pypi.python.org/pypi/setuptools
win7 32位可以下载setuptools-0.6c11.win32-py2.7.exe 。双击即可安装
win7 64位必须使用ez_setup.py进行安装。方法是下载ez_setup.py后,在cmd下执行 python ez_setup.py,即可自动安装setuptools。目前没有直接的exe安装版本。
python setup.py install
安装完毕后会在Python目录下scripts目录里包含一个easy_install.exe,
然后进行环境变量设置,在系统环境变量中做如下设置:
(也就是将D:\Program Files\python2.7\scripts添加到环境变量中)
C:\Users\zhuyupeng>easy_install
error: No urls, filenames, or requirements specified (see --help)
上面这种方式不正确,需要使用下面的方式:
C:\Users\zhuyupeng>easy_install virtualenv
Python 模块
操作MySQL数据库模块
https://pypi.python.org/pypi/MySQL-python/
wget https://pypi.python.org/pypi/MySQL-python/MySQL-python-1.2.5.zip
unzip MySQL-python-1.2.5.zip
yum -y install python-devel # apt-get install python-devel
cd MySQL-python-1.2.5
python setup.py build
python setup.py install
----------linux-----------------------
第一种基本安装方法
1 下载包,解压
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
tar zxvf Python-2.7.12.tgz
2 cd Python-2.7.12
3
./configure --prefix=/usr/local/python
make
make install
看到包内的文件在安装即可……
centos6 替换系统自带Python
1.#备份旧Python 到 python2.6
mv /usr/bin/python /usr/bin/python2.6
2.#建立软连接
ln -sf /usr/local/python/bin/python2.7 /usr/bin/python
3.修正yum
#文件开头的第一行代码的Python解析器修改为:#!/usr/bin/python2.6
vi /usr/bin/yum
#安装python-setuptools
Ubuntu
>apt-get install python-setuptools
# 安装pip
>easy_install pip
>pip install pyftpdlib
centOS
>yum install python-setuptools
windows
下载 --
#安装pytest模块
>easy_install pytest
#安装requests模块
>easy_install requests
#安装pip模块
>easy_install pip
#安装 yaml
>pip install PyYaml
# 查询是否安装 MySQL数据库
>which mysql
(1)Centos7中用MariaDB代替了mysql数据库,安装使用mariadb
(2)CentOS7的yum源中默认好像是没有mysql的
1. 下载mysql的repo源
$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2. 安装源包,会获得两个mysql的yum repo源:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo。
$ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
3. 安装mysql
$ sudo yum install mysql-server
#把/var/lib/mysql的拥有者改为当前用户:
chown -R root:root /var/lib/mysql
# 重启服务
>service mysqld restart
>mysql -u root
mysql>use mysql;
mysql>update user set password=password('123456') where user = 'root';
mysql>exit;
-----------------------------windows----------------------------------------------------------------------------------------------------
1 下载包,解压
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
tar zxvf Python-2.7.12.tgz
2 cd Python-2.7.12
3 输入python setup.py build
4 输入python setup.py install
看到包内的文件在安装即可……
下载安装python安装工具 http://pypi.python.org/pypi/setuptools
win7 32位可以下载setuptools-0.6c11.win32-py2.7.exe 。双击即可安装
win7 64位必须使用ez_setup.py进行安装。方法是下载ez_setup.py后,在cmd下执行 python ez_setup.py,即可自动安装setuptools。目前没有直接的exe安装版本。
python setup.py install
安装完毕后会在Python目录下scripts目录里包含一个easy_install.exe,
然后进行环境变量设置,在系统环境变量中做如下设置:
(也就是将D:\Program Files\python2.7\scripts添加到环境变量中)
C:\Users\zhuyupeng>easy_install
error: No urls, filenames, or requirements specified (see --help)
上面这种方式不正确,需要使用下面的方式:
C:\Users\zhuyupeng>easy_install virtualenv
Python 模块
操作MySQL数据库模块
https://pypi.python.org/pypi/MySQL-python/
wget https://pypi.python.org/pypi/MySQL-python/MySQL-python-1.2.5.zip
unzip MySQL-python-1.2.5.zip
yum -y install python-devel # apt-get install python-devel
cd MySQL-python-1.2.5
python setup.py build
python setup.py install