我在环境上吃了大亏,
python的环境是3.9
如果是纯净的python环境我不建议现在安装python
下载
wget http://npm.taobao.org/mirrors/python/3.9.0/Python-3.9.0.tgz
解压 & 迁移
mv Python-3.9.0.tgz /usr/local/
输入cd /usr/local
进入local
目录 输入
tar -zxvf Python-3.9.0.tgz
解压完成 进入cd python-3.9.0
目录
输入./configure prefix=/usr/local/python3
进行配置
然后使用 make && make install
进行编译
肯定有简易方法, 但是我不会,,,
建立软连接的时候可能会出现这个问题
ln -sf /usr/python/bin/python3(python 安装目录) /usr/bin/python
加个f即可
find / -name lsb_release
rm -rf /usr/bin/lsb_release
sudo apt-get install libffi-dev
apt-get install libbz2-dev
记得自己改链接
wget https://sqlite.org/2023/sqlite-autoconf-3410000.tar.gz
tar zxvf sqlite-autoconf-3410000.tar.gz
cd sqlite-autoconf-3410000
./configure
make && make install
安装完后你可以看见如下提示
#手动安装sqlite3 完成的时候会有这么一段提示:
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/sqlite3/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
这段内容显示了sqlite3的安装路径:/usr/local/sqlite3/lib
。
特别注意add LIBDIR to the ‘LD_LIBRARY_PATH’ environment variable
,这是sqlite
建议添加环境变量。
所以:
echo export LD_LIBRARY_PATH=/usr/local/lib >> /etc/profile
source /etc/profile
也有可能失败
通过find / -name *libsqlit3.so
查找,能发现3个文件libsqlite3.so.0
等,将这些文件删除并替换,重新编译python3安装就能够成功了
然后切记 要重新编译一下你的python!!!