CentOs 6安装python2.7.13及异常解决
1、CentOS安装Python的依赖包
yum groupinstall "Development tools" yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
2、下载Python2.7.13的源码包并编译
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz tar xf Python-2.7.13.tgz cd Python-2.7.13 ./configure --prefix=/usr/local make make install
可能出现的异常:
import sqlite3时抛出异常:ModuleNotFoundError: No module named '_sqlite3'
没有安装pip
1.import sqlite3时抛出异常:ModuleNotFoundError: No module named '_sqlite3'
yum install --installroot=/usr/local/ sqlite3
修改python setup.py文件
cd Python-2.7.13 vi ./setup.py
sqlite_inc_paths = [ '/usr/include', '/usr/local/sqlite3/include', #增加该部分内容 '/usr/include/sqlite', '/usr/include/sqlite3', '/usr/local/include', '/usr/local/include/sqlite', '/usr/local/include/sqlite3',]
然后重新编译就可以了。
2.没有安装pip
# 安装Pip wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz tar -vxf setuptools-1.4.2.tar.gz cd setuptools-1.4.2 python2.7 setup.py install # 若系统默认的为python2.7可以直接使用python easy_install-2.7 pip
相关推荐
changecan 2020-11-19
ECSHOP专属建设 2020-11-13
88427810 2020-11-02
步知道 2020-10-27
Junzizhiai 2020-10-10
jackalwb 2020-10-05
小网管 2020-09-03
shiwenqiang 2020-09-14
85251846 2020-09-14
summerinsist 2020-08-21
87901735 2020-08-19
PinkBean 2020-08-11
85407718 2020-08-09
MichelinMessi 2020-07-30
suosuo 2020-07-28
CARBON 2020-07-28
lizhengfa 2020-07-27
88427810 2020-07-26