简体   繁体   中英

Centos6.9 install python3.5 display error permission denied after make

  1. CentOS release 6.9 (Final) : Linux version 2.6.32-696.10.2.el6.i686 (mockbuild@c1bl.rdu2.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Tue Sep 12 13:54:13 UTC 2017

  2. Install command :

    wget https://www.python.org/ftp/python/3.5.4/Python-3.5.4.tgz tar -zxvf Python-3.5.4.tgz cd Python-3.5.4 mkdir /usr/local/python3.5 ./configure --prefix=/usr/local/python3.5

  3. Error step :

    make

    gcc -pthread -c -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -I. -I./Include -DPy_BUILD_CORE \\ -DGITVERSION="\\" gcc -pthread -c -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -I. -I./Include -DPy_BUILD_CORE \\ -DGITVERSION="\\" LC_ALL=C \\"" \\ -DGITTAG="\\" LC_ALL=C \\"" \\ -DGITBRANCH="\\" LC_ALL=C \\"" \\ -o Modules/getbuildinfo.o ./Modules/getbuildinfo.c /bin/sh: /usr/bin/gcc: Permission denied make: *** [Modules/getbuildinfo.o] Error 126

  4. the power of /bin/sh and /usr/bin/gcc

    [root@iZ2814clj1uZ Python-3.5.4]# ll /bin/sh lrwxrwxrwx 1 root root 4 May 11 2017 /bin/sh -> bash [root@iZ2814clj1uZ Python-3.5.4]# ll /bin/bash -rwxr-xr-x 1 root root 872372 Mar 23 2017 /bin/bash [root@iZ2814clj1uZ Python-3.5.4]# ll /usr/bin/gcc -rwxr-xr-x 2 root root 234948 Mar 22 2017 /usr/bin/gcc

  5. I haved tried chmod 777 /bin/sh , /bin/bash , /usr/bin/gcc and reboot the system, but it doesn't work. Has anyone else had this problem with this ? Thanks for any help/suggestions.

update 2017-11-13: selinux audit log

type=USER_AUTH msg=audit(1510502012.108:840): user pid=4273 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:authentication acct="root" exe="/usr/sbin/sshd" hostname=[ip address1] addr=[ip address1] terminal=ssh res=success' type=USER_ACCT msg=audit(1510502012.108:841): user pid=4273 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:accounting acct="root" exe="/usr/sbin/sshd" hostname=[ip address1] addr=[ip address1] terminal=ssh res=success' type=CRYPTO_KEY_USER msg=audit(1510502012.108:842): user pid=4273 uid=0 auid=4294967295 ses=4294967295 msg='op=destroy kind=session fp=? direction=both spid=4274 suid=74 rport=31432 laddr=[ip address] lport=5676 exe="/usr/sbin/sshd" hostname=? addr=[ip address1] terminal=? res=success' type=USER_AUTH msg=audit(1510502012.108:843): user pid=4273 uid=0 auid=4294967295 ses=4294967295 msg='op=success acct="root" exe="/usr/sbin/sshd" hostname=? addr=[ip address1] terminal=ssh res=success' type=CRED_ACQ msg=audit(1510502012.109:844): user pid=4273 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:setcred acct="root" exe="/usr/sbin/sshd" hostname=[ip address1] addr=[ip address1] terminal=ssh res=success' type=LOGIN msg=audit(1510502012.109:845): pid=4273 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=106 type=USER_START msg=audit(1510502012.111:846): user pid=4273 uid=0 auid=0 ses=106 msg='op=PAM:session_open acct="root" exe="/usr/sbin/sshd" hostname=[ip address1] addr=[ip address1] terminal=ssh res=success' type=USER_LOGIN msg=audit(1510502012.189:847): user pid=4273 uid=0 auid=0 ses=106 msg='op=login id=0 exe="/usr/sbin/sshd" hostname=[ip address1] addr=[ip address1] terminal=ssh res=success

Today,I found the answer. I haved install a security software, which prohibited create and excute binary file in the system directory. So I uninstalled it and my system back to normal.

Download miniconda from https://conda.io/miniconda.html . Miniconda is the light version of Anaconda from continuum. It comes with the latest python -v and virtual env, and package installer 'conda'.

cd /tmp
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
sudo bash ./*.sh

When it prompts for install directory use

/home/user/.miniconda3

You don't have to do this but placing it in a hidden directory reduces the clutter.

Conda handles virtual envs and package installations.

  1. To create an environment, conda create -n newEnv python="python version"
  2. To start an environment, source activate newEnv.
  3. To install packages, conda install "something"
  4. Some packages, may not be available on conda so you use pip , within the environment.
  5. I use Ubuntu, so I install pip via, sudo apt-get install python-pip.
  6. Upgrade pip by, python install --upgrade pip

See conda cheatsheet, https://conda.io/docs/_downloads/conda-cheatsheet.pdf

It's still the same issue http://thomas-cokelaer.info/blog/2014/08/installation-of-python-2-6-error-fixed/

My advice is to stick with "yum install python3" and save your time. I think they're on 3.4 right now, of course if you don't need something specific from 3.5.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM