python环境搭建(linux)

python安装

# wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz

# yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel //安装可能的依赖库
# tar -zxvf Python-3.6.2.tgz
# cd Python-3.6.2/
# ./configure --prefix=/usr/local/ //安装到/usr/local目录
# make
# make altinstall //此处不能用install安装,因为install不区分版本,会出现多版本混乱的问题
python3.6程序的执行文件:/usr/local/bin/python3.6
  python3.6应用程序目录:/usr/local/lib/python3.6
  pip3的执行文件:/usr/local/bin/pip3.6
  pyenv3的执行文件:/usr/local/bin/pyenv-3.6
  更改python默认链接
# cd/usr/bin
# mv  python python.backup
# ln -s /usr/local/bin/python3.6 /usr/bin/python
# ln -s /usr/local/bin/python3.6 /usr/bin/python3
 
 
安装过程中存在的问题:
1、-bash: wget: 未找到命令
python环境搭建(linux)

解决办法:安装wget

yum -y install wget

2、配置Python3.5,使用./configure --prefix=/usr/local/Python3.5.3报错如下

checking build system type... x86_64-pc-linux-gnu

checking host system type... x86_64-pc-linux-gnu
checking for python3.5... no
checking for python3... no
checking for python... python
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... linux
checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/root/Python-3.5.3':
configure: error: no acceptable C compiler found in $PATH

解决办法安装“Development tools”开发工具包,然后再./configure就可以了

yum groupinstall "Development tools" -y
 
 
 
 
 
 
 
 
 
 
上一篇:基于 Markdown 编写接口文档


下一篇:Windows下createfile函数用GENERIC_READ访问模式打不开磁盘