大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。
Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺
前言
使用docker安装jenkins环境,jenkins构建的workspace目录默认是在容器里面构建的,如果我们想执行python3的代码,需进容器内部安装python3的环境。
进jenkins容器
进docker容器, 加上-u root 以root用户权限进入容器
docker exec -it -u root 容器id /bin/bash
查看当前操作系统cat /etc/issue
root@3be4b6cd9b8c:/# uname -a
Linux 3be4b6cd9b8c 4.19.121-linuxkit #1 SMP Tue Dec 1 17:50:32 UTC 2020 x86_64 GNU/Linux
root@3be4b6cd9b8c:/# cat /etc/issue
Debian GNU/Linux 9 \n \
这里查到的是Debian系统(不是ubuntu, 也不是centos),这里yum是没有的,所以不能用yum安装了,这里用apt-get代替yum
先执行更新apt-get
apt-get update
容器内部安装python3环境
下载python3安装包
root@3be4b6cd9b8c:/var/jenkins_home# cd /var/jenkins_home/
root@3be4b6cd9b8c:/var/jenkins_home# mkdir python3
root@3be4b6cd9b8c:/var/jenkins_home# cd python3/
root@3be4b6cd9b8c:/var/jenkins_home/python3# wget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tgz
root@3be4b6cd9b8c:/var/jenkins_home/python3# tar -xvf Python-3.76.tgz
root@3be4b6cd9b8c:/var/jenkins_home/python3# ls
Python-3.7.6 Python-3.7.6.tgz
root@3be4b6cd9b8c:/var/jenkins_home/python3# cd Python-3.7.6
root@3be4b6cd9b8c:/var/jenkins_home/python3/Python-3.7.6# ./configure --prefix=/var/jenkins_home/python3
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.7... 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 `/var/jenkins_home/python3/Python-3.7.6':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
执行 ./configure –prefix=/var/jenkins_home/python3时报上面错:configure: error: no acceptable C compiler found in $PATH
apt-get 安装依赖包
这个是因为缺少gcc相关依赖包,使用apt-get代替yum安装相关依赖包
apt-get -y install gcc automake autoconf libtool make
apt-get -y install make*
apt-get -y install zlib*
apt-get -y install openssl libssl-dev
apt-get install sudo
由于python3.7以上版本在make install步骤中会出现缺少依赖(缺少_ctype)的错误提示,所以还需安装下面的依赖包
sudo apt-get update
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus
sudo apt-get install build-essential libncursesw5-dev libgdbm-dev libc6-dev
sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
sudo apt-get install libssl-dev openssl
sudo apt-get install libffi-dev
sudo apt-get install libxpm-dev libxext-dev
sudo apt-get install zlib1g-dev libbz2-dev libssl-dev libncurses5-dev libsqlite3-dev
make编译安装
在/var/jenkins_home/python3/Python-3.7.6目录执行make和make install 安装
./configure --prefix=/var/jenkins_home/python3 --with-ssl
make
make install
添加软链接
添加python3软链接
ln -s /var/jenkins_home/python3/bin/python3.6 /usr/bin/python3
添加pip3软链接
ln -s /var/jenkins_home/python3/bin/pip3 /usr/bin/pip3
输入pip3 和python3检查环境
root@3be4b6cd9b8c:/# python3 --version
Python 3.7.6
root@3be4b6cd9b8c:/# pip3 --version
pip 19.2.3 from /var/jenkins_home/python3/lib/python3.7/site-packages/pip (python 3.7)
root@3be4b6cd9b8c:/#
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/165304.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...