1、安装 sqlite-devel
因为 Flask 应用程序可能使用能 sqlite 数据库,所以这个得装上(之前因为没装这个,导致 Python 无法导入 sqlite3 库。
当然,也可以从源码编译安装。
yum install sqlite-devel -y
2、安装 Python 2.7
wget https://www.python.org/ftp/python/2.7.8/Python-8.tgz
tar xf 8.tgz
cd 8
./configure --prefix=/usr/local
make && make install
安装成功之后,你可以在/usr/local/bin/python2.7
找到 Python 2.7。
3、环境变量
[root@localhost bin]# python Python 2.7.8 (default,Apr 26 2017,14:31:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2 Type "help","copyright","credits" or "license" for more information.
4、安装 setuptools + pip
wget --no-check-certificat https://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.tar.gz
# Then install it for Python 2.7 : python ez_setup.py # Now install pip using the newly installed setuptools: easy_install pip ll # With pip installed you can now do things like this: pip2.7 install [packagename] pip2.7 install --upgrade [packagename] pip2.7 uninstall [packagename]
原文链接:https://www.f2er.com/centos/377811.html