Python2.7 / Pip2.7 install in Centos6: root does not see /usr/local/bin
this stackoverflow entry probably explains what you are seeing. pixelbeat's suggests you alias sudo to set your environment each time it is called:
alias sudo='sudo env PATH=$PATH'
That workaround should resolve your issue. Personally, I prefer aliasing python2.7 and pip2.7.
Related videos on Youtube
Comments
-
Erotemic almost 2 years
I am trying to install Python2.7 in Centos 6. It's a pain as centos6 ships with python26 and yum is dependent on it. Furthermore yum does not seem to have python2.7
I ended up building it from source:
wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz gunzip Python-2.7.6.tgz tar -xvf Python-2.7.6.tar cd Python-2.7.6 ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" make sudo make altinstall cd ~
This installed python2.7 to /usr/local/bin and I can use it. But I cannot call it with sudo unless I specify the whole pathname
To install pip I had to do:
wget https://bootstrap.pypa.io/get-pip.py sudo /usr/local/bin/python2.7 get-pip.py
Now whenever I want a package I have to call
sudo /usr/local/bin/pip2.7 install somepackage
Is there a clean way to be able to run:
sudo pip2.7 install somepackage
without having to specify the absolute path? Is a symlink into /usr/bin safe?
-
Cfinley almost 10 yearsWhilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
-
verboze almost 10 yearsgood point. answer updated.