1

I have remote account of a super computer. I have to install a software CMUSphinx, Which requires swig 2.0+ version as dependency. But Server have version 1.3.40 installed.

Now I can not update it because I am not root user, so I installed swig 3.0.12 in my local account under the path $HOME/local/swig It was installed properly.

But after installation I checked the version and it still says 1.3.40.

So I suppose there must be some path or anything which I need to update but I dont know what exactly I need to change. As I am new to Unix.

enter image description here

  • In the the answers and comments to your other question it was already written that you need to update your PATH variable. Better read that or your next problem will be with shared library versions, because you didn't set the LD_LIBRARY_PATH – Philippos Apr 21 '17 at 10:55
  • @Philippos that was updated later. but still I think that is not what I am looking for. That answer focus on setting user sessions but I want to add path and dont know where to and how to add. – Adnan Ali Apr 21 '17 at 16:24
2

When you type swig on the command line, the shell will search for that command in the directories listed in the $PATH variable. It will use the first match that it finds.

Since the swig that you installed (most likely) lives in $HOME/local/swig/bin and since this directory is either not in your $PATH or too late in the it, it picks up the older version of the command.

Put $HOME/local/swig/bin early in your path (verify that this is the correct directory first):

PATH="$HOME/local/swig/bin:$PATH"

See also How do I set a user environment variable? (permanently, not session)

Alternatively, run swig with the path specified:

$ ~/local/swig/bin/swig

Or, if you are in your home directory:

$ local/swig/bin/swig
  • i dont know where to add path. can you please tell me that. – Adnan Ali Apr 21 '17 at 16:25
  • 1
    @AdnanAli In your ~/.bash_profile (or ~/.bashrc), add export PATH="$HOME/local/swig/bin:$PATH". Log out and then log in again. – Kusalananda Apr 21 '17 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.