One - One Code All

Blog Content

centos升级安装python3.9

Python Linux-Mac   2021-04-17 20:05:11

python 不能增量升级,只能卸载老的,再安装新的版本。

yum install libffi-devel zlib-devel openssl-devel readline-devel
# 安装pandas需要
yum install bzip2-devel xz-devel python-backports-lzma
wget https://www.python.org/ftp/python/3.9.4/Python-3.9.4.tgz
cd Python-3.9.4
tar -xvf Python-3.9.4.tgz
./configure --prefix=/usr/local/python3
make && make install
make clean
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

安装成功

rm /usr/local/python3/lib/python3.9/lib-dynload/_sysconfigdata__linux_x86_64-linux-gnu.py
rm -r /usr/local/python3/lib/python3.9/lib-dynload/__pycache__
/usr/bin/install -c -m 644 ./Misc/python.man \
	/usr/local/python3/share/man/man1/python3.9.1
if test ! -d /usr/local/python3/lib/pkgconfig; then \
	echo "Creating directory /usr/local/python3/lib/pkgconfig"; \
	/usr/bin/install -c -d -m 755 /usr/local/python3/lib/pkgconfig; \
fi
if test -f /usr/local/python3/bin/python3 -o -h /usr/local/python3/bin/python3; \
then rm -f /usr/local/python3/bin/python3; \
else true; \
fi
(cd /usr/local/python3/bin; ln -s python3.9 python3)
if test "3.9" != "3.9"; then \
	rm -f /usr/local/python3/bin/python3.9-config; \
	(cd /usr/local/python3/bin; ln -s python3.9-config python3.9-config); \
	rm -f /usr/local/python3/lib/pkgconfig/python-3.9.pc; \
	(cd /usr/local/python3/lib/pkgconfig; ln -s python-3.9.pc python-3.9.pc); \
	rm -f /usr/local/python3/lib/pkgconfig/python-3.9-embed.pc; \
	(cd /usr/local/python3/lib/pkgconfig; ln -s python-3.9-embed.pc python-3.9-embed.pc); \
fi
rm -f /usr/local/python3/bin/python3-config
(cd /usr/local/python3/bin; ln -s python3.9-config python3-config)
rm -f /usr/local/python3/lib/pkgconfig/python3.pc
(cd /usr/local/python3/lib/pkgconfig; ln -s python-3.9.pc python3.pc)
rm -f /usr/local/python3/lib/pkgconfig/python3-embed.pc
(cd /usr/local/python3/lib/pkgconfig; ln -s python-3.9-embed.pc python3-embed.pc)
rm -f /usr/local/python3/bin/idle3
(cd /usr/local/python3/bin; ln -s idle3.9 idle3)
rm -f /usr/local/python3/bin/pydoc3
(cd /usr/local/python3/bin; ln -s pydoc3.9 pydoc3)
rm -f /usr/local/python3/bin/2to3
(cd /usr/local/python3/bin; ln -s 2to3-3.9 2to3)
if test "x" != "x" ; then \
	rm -f /usr/local/python3/bin/python3-32; \
	(cd /usr/local/python3/bin; ln -s python3.9-32 python3-32) \
fi
rm -f /usr/local/python3/share/man/man1/python3.1
(cd /usr/local/python3/share/man/man1; ln -s python3.9.1 python3.1)
if test "xupgrade" != "xno"  ; then \
	case upgrade in \
		upgrade) ensurepip="--upgrade" ;; \
		install|*) ensurepip="" ;; \
	esac; \
	 ./python -E -m ensurepip \
		$ensurepip --root=/ ; \
fi
Looking in links: /tmp/tmpu4v_dlxm
Processing /tmp/tmpu4v_dlxm/setuptools-49.2.1-py3-none-any.whl
Processing /tmp/tmpu4v_dlxm/pip-20.2.3-py2.py3-none-any.whl
Installing collected packages: setuptools, pip
  WARNING: The script easy_install-3.9 is installed in '/usr/local/python3/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts pip3 and pip3.9 are installed in '/usr/local/python3/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.2.3 setuptools-49.2.1



上一篇:python pymysql转义方法escape_string使用说明及报错解决方法
下一篇:修改sublime text 3 build with python路径

The minute you think of giving up, think of the reason why you held on so long.