【Windows安装笔记】
下载:https://www.python.org/downloads/
PIP下载:https://pypi.python.org/pypi/pip/
《安装Python》
1.双击运行python-2.7.13.msi
2.添加环境变量cmd下输入: path=%path%;D:\python
3.测试: cmd下,输入Python
《cmd下安装pip》
1.打开文件目录:cd [pip目录]
2.安装文件:Python setup.py install //必须先添加Python的环境变量
3.添加环境变量:path=%path%;[pip目录]\scrip
4.测试cmd下,输入pip
《安装模块》
1.pip install <模块名>
如提示:error:Microsoft virtual c++ request....
按提示打开连接并下载相关插件便可
【Linux安装笔记】
mkdir /home/root
cd /home/root
yum install -y wget //安装需要的wget
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz //下载安装包
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel //安装必要的软件包
tar -Jxvf Python-3.5.0.tar.xz //J为大写
tar -zxvf Python-3.5.0.tar.gz //J为大写
cd Python-3.5.0
./configure --prefix=/usr/local/python3.6.2 //指定安装目录
make && make install //开始安装
PATH=/usr/local/python3.6/bin:$PATH 添加环境变量
或
echo -e "PATH=/usr/local/python3.6/bin:$PATH /n export PATH" >> /etc/profile
<下文有误,pip被Python2调用,pip3被Python3用>
wget https://bootstrap.pypa.io/get-pip.py 安装pip
python get-pip.py
pip install requests //requests包
pip install pyquery //pyquery包
pip install pymysql //pymysql包