python坑之编译安装python
python坑之编译安装python
坑:
(1)运行django项目时报错:缺少sqlite3,下面编译迁需要先安装sqlite3
django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3'
1.安装Python依赖包:
yum install libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite sqlite-devel readline-devel tk-devel gcc make -y
2.编译安装python
./configure --prefix=/usr/local/python2.7
# python3.11
./configure --prefix=/usr/local/python3.11 --with-openssl=/usr/local/openssl/
make make install
3.编译安装 setuptools-41.0.1.zip pip-19.1.1.tar.gz
解压 编译:/usr/local/python2.7/bin/python setup.py build 安装:/usr/local/python2.7/bin/python setup.py install
4.配置环境变量
vim /etc/profile #加入以下内容 PATH=/usr/local/python2.7/bin:$PATH #使用pip安装django后再加入 PATH=/usr/local/python2.7/lib/python2.7/site-packages/django/bin:$PATH
5.创建软连接
先重命名/usr/bin/xxx mv /usr/bin/python /usr/bin/python2.6.bak mv /usr/bin/pip /usr/bin/pip2.bak ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python ln -s /usr/local/python2.7/bin/pip2.7 /usr/bin/pip
6.修改yum
which yum vim /usr/bin/yum #!/usr/bin/python2.6
6.常见问题
https://blog.csdn.net/zhangping1987/article/details/47974677
一些事情一直在干,说不定以后就结果了呢
本文来自博客园,作者:chenjianwen,转载请注明原文链接:https://www.cnblogs.com/chenjw-note/articles/7700347.html