1

I asked this at stackoverflow, but just realized it might be best here. If I need to delete it over there or should not have posted here, please let me know. I am still new to this site. Thanks in advance!

I'm using centos 7 and was trying to install python 3.4 alongside python 2.6 (2.7?) the default install. I was attempting to change my bashrc file with an alias to make python 3.4 the default from the shell. It did not work, and I commented out the script, resourced bashrc, and now the system acts as if it can no longer find python, default or otherwise.

Just typing "python" returns:

-bash: python: command not found 

which python gives:

/usr/bin/which: no python in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/myusername/.local/bin:/home/myusername/bin) 

However there is a python install in both /usr/bin and /usr/sbin.

alternatives --list | grep -i python yields:

    python  auto  /usr/bin/python3.4

-v python returns nothing.

type -a python gives:

 -bash: type: python: not found

declare -p PATH outputs

declare -x PATH="/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/myusername/.local/‌​bin:/home/myusername/bin"

I am not entirely sure where to go from here, and any help would be much appreciated.

I do seem to have /usr/bin/python:

$ ls -l /usr/bin/python
lrwxrwxrwx 1 root root 24 Jun 25 15:39 /usr/bin/python -> /etc/alternatives/python 

but:

$ ls -l $(readlink -f /usr/bin/python) gives:

ls: cannot access /usr/bin/python3.4: No such file or directory

I do not know if this is relevant, but /etc/alternatives/python was pink looking in the terminal.

Edit 2:

ls -l /usr/local/bin/ prints -rwxr-xr-x 1 root root 101 Sep 4 2014 2to3-3.4 -rwxr-xr-x 1 root root 241 Sep 4 2014 easy_install-3.4 -rwxr-xr-x 1 root root 99 Sep 4 2014 idle3.4 -rwxr-xr-x 1 root root 213 Sep 4 2014 pip3.4 -rwxr-xr-x 1 root root 84 Sep 4 2014 pydoc3.4 -rwxr-xr-x 2 root root 17544 Sep 4 2014 python3.4 -rwxr-xr-x 2 root root 17544 Sep 4 2014 python3.4m -rwxr-xr-x 1 root root 3066 Sep 4 2014 python3.4m-config -rwxr-xr-x 1 root root 236 Sep 4 2014 pyvenv-3.4 So perhaps a linking error still?

Edit 3:

This is the series of commands which I used to install python 3.

yum install scl-utils sudo yum install scl-utils sudo wget https://www.softwarecollections.org/en/scls/rhscl/python33/epel-7-x86_64/download/rhscl-python33-epel-7-x86_64.noarch.rpm sudo yum install rhscl-python33-*.noarch.rpm

2
  • Please don't cross-post. If you think this is a better fit (and you're probably right), please delete your question from SO. Otherwise, both will end up being closed.
    – terdon
    Jun 29, 2015 at 23:26
  • Thank you for informing me, the other post has been deleted.
    – Aerdowaith
    Jun 30, 2015 at 15:25

2 Answers 2

1

It looks like you've lost your python installation. You have a link at /usr/bin/python which is pointing to /etc/alternatives/python. However, that itself is a link that is pointing to /usr/bin/python3.4 a file which apparently doesn't exist:

ls: cannot access /usr/bin/python3.4: No such file or directory

So, it looks like you simply haven't installed python3.4. I suggest you ask a new question, explaining exactly how you installed it.

8
  • I will try adding that link and reply back with how it goes. Thanks!
    – Aerdowaith
    Jun 30, 2015 at 15:26
  • Bash returned: ln: failed to create symbolic link '/usr/bin/python': File exists So apparently this link already exists, or am I not understanding the message?
    – Aerdowaith
    Jun 30, 2015 at 15:29
  • @Aerdowaith no, you're understanding it perfectly. That's odd. Please edit your question and add the output of ls -l /usr/bin/python and ls -l $(readlink -f /usr/bin/python).
    – terdon
    Jun 30, 2015 at 15:41
  • Links and symbolic links are a concept I have yet to fully grasp, so I wanted to make sure.
    – Aerdowaith
    Jun 30, 2015 at 15:52
  • @Aerdowaith OK, see updated answer. You don't have python3.4 installed.
    – terdon
    Jun 30, 2015 at 15:57
-1

You used scl. It's a software collections install of python 3.4. You need to refer to the scl docs on running it. It's not what you would expect.

Enabling a Software Collection

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .