Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I created a symbolic link (yesterday) like this:

sudo ln -s bin/python /usr/bin/prj-python

When I run:

prj-python file.py

I get:

prj-python: command not found

When I try creating the link again, I get:

ln: creating symbolic link `/usr/bin/prj-python': File exists

Why is that happening? My $PATH is:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/real/RealPlayer

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

You forgot the initial slash before bin/python. This means /usr/bin/prj-python now points to /usr/bin/bin/python. What would you like it to point to exactly?

share|improve this answer
    
There is not initial slash. the pwd is /home/xralf/my_virtual_env and it has subdirectory bin with python command –  xralf Oct 16 '11 at 18:44
3  
Than, you've forgot $PWD/ before bin. –  rvs Oct 16 '11 at 20:38
    
Thank you, this helped. I used this command as it was in the book. –  xralf Oct 17 '11 at 9:50
add comment

Things to check:

  • Perform an ls -l on /usr/bin/prj-python if its like

    lrwxrwxrwx (...) /usr/bin/prj-python -> bin/python

    the file will actually be searched at /usr/bin/bin/python (that's what xralf tried to say). Fix:

    rm /usr/bin/prj-python
    ln -s /full/path/to/your/python /usr/bin/python-prj

  • If your bin/python is a shell script (aka. wrapper-script) check the #!-line (sometimes called shebang-line) at the first line. If there's a typo like #!/bin/bush that will cause a not found error message also.

share|improve this answer
    
thank you, your answer is even more careful and educational. Sorry I already accepted. –  xralf Oct 17 '11 at 9:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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