1

Under /numpy folder

$ sudo python3 setup.py install
sudo:python3:command not found

Or try

$ sudo python3 distribute_setup.py
sudo:python3:command not found


$ python3
Python 3.2.2 (default, Sep 12 2013, 01:58:11) 
[GCC 4.6.3 20120306 (Red Hat 4.6.3-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

which python3 says

$ which python3
/usr/local/bin/python3

Update:

$ sudo which python3
which: no python3 in (/sbin:/bin:/usr/sbin:/usr/bin)
$ sudo echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/xxxx/bin

Update2:

$ sudo sh -c 'echo $PATH'
/sbin:/bin:/usr/sbin:/usr/bin

I have rhel/redhat and successfully installed python3.2.2 by downloading the package. Those threads about apt-get don't work for this version. Does anyone has an idea?

6
  • Does redhat change the search path ($PATH) when using sudo? What do sudo which python3 and sudo echo $PATH say? Commented Sep 12, 2013 at 3:07
  • The result of sudo which python3 shows the problem. When you use sudo, /usr/local/bin is not in $PATH. I think sudo echo $PATH didn't do what I wanted; instead, check sudo sh -c 'echo $PATH'. Commented Sep 12, 2013 at 3:18
  • @WarrenWeckesser I already reinstalled. I don't know what's wrong and how to fix it. Commented Sep 12, 2013 at 3:21
  • You could try giving the full path to the python3 command: sudo /usr/local/bin/python3 setup.py install. Commented Sep 12, 2013 at 3:23
  • @WarrenWeckesser Problem solved, it's amazing. Thanks a lot! I just curious why this happens. Where could I add a line and point to this path? Commented Sep 12, 2013 at 3:29

2 Answers 2

4

When using sudo in redhat, /usr/local/bin is not included in the search path. To run python3 with sudo, give the full path to the executable:

$ sudo /usr/local/bin/python3 setup.py install
Sign up to request clarification or add additional context in comments.

Comments

1

Another rude solution is to copy symbolic link of python3 and pip3 from /usr/local/bin to /usr/bin :

$ sudo cp /usr/local/bin/python3 /usr/bin
$ sudo cp /usr/local/bin/pip3 /usr/bin

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.