0

I am new to python and OSX terminal commands. I wanted to permanently add a directory to PYTHONPATH, thus I looked here and used these instructions:

1-Open up Terminal

2-Type open .bash_profile

3-In the text file that pops up, add this line at the end: export PYTHONPATH=$PYTHONPATH:foo/bar

4-Save the file, restart the Terminal, and you're done

I also followed this instruction:

export PYTHONPATH="${PYTHONPATH}:/my/other/path"

After these changes I cannot use any command like python, which, whereis, pip, etc. in Terminal :(

The response is something like below:

-bash: which: command not found

I do not know what I have done.

Community
  • 1
  • 1
anahita
  • 45
  • 4
  • My `bash_profile` entry looks like this: `# Setting PATH for Python 3.4 PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}" export PATH` – albert Nov 27 '15 at 14:17
  • @albert yes before changes mine was like you , but I changed it! and save it . Now, I even cannot open `.bash_profile` again. I got `-bash: open: command not found` – anahita Nov 27 '15 at 14:19
  • Could you find out, where the Python installation was installed to? And it would be great if you could add your `.bash_profile` to your question. – albert Nov 27 '15 at 14:20
  • @albert from terminal no!! because I cannot use `whereis` or` which` commands , but I know where is my framework. – anahita Nov 27 '15 at 14:22
  • @albert how can I open my `.bash_profile` again? I cannot open it from `terminal` – anahita Nov 27 '15 at 14:23
  • Just remove the command again and everything should work as before. After that you should find out where the desired installation is located. – albert Nov 27 '15 at 14:23
  • 2
    Did you delete your `$PATH` variable in that process? This seems like such a problem... – tschoppi Nov 27 '15 at 14:24
  • You can [make hidden files visible](http://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/) and open it from finder. – albert Nov 27 '15 at 14:25
  • @albert after looked at your link, I used command `sudo nano ~/.bash_profile` and got `-bash: sudo: command not found` – anahita Nov 27 '15 at 14:30
  • @tschoppi how can I check it? – anahita Nov 27 '15 at 14:31
  • Since you say that you cannot execute anything in your command line / terminal you should consider to [reset `.bash_profile`](http://superuser.com/a/498356). – albert Nov 27 '15 at 14:33

1 Answers1

-1

are you sure you have appended the path because what i can see is you have replaced old path definition and assigned a new one

remove bash profile use one of these commands /bin/rm ~/.bash_profile Or if you want to save your current bash configs then use a mv instead /bin/mv ~/.bash_profile ~/bash_profile Then close your terminal and start again you will be able to use all commands and apps

devendermahto
  • 133
  • 1
  • 4
  • This is rather a comment as an answer. – albert Nov 27 '15 at 14:29
  • remove bash profile use one of these commands **/bin/rm ~/.bash_profile** Or if you want to save your current bash configs then use a mv instead **/bin/mv ~/.bash_profile ~/bash_profile** Then close your terminal and start again you will be able to use all commands and apps – devendermahto Nov 27 '15 at 14:34
  • that worked @devendermahto! thanks. if you answer my question instead of comment I can accept your answer! thanks again! – anahita Nov 27 '15 at 14:41
  • edited above answer you can go ahead and accept this as an Answer and i'm also trying to give you the exact command you need to use in order to append path – devendermahto Nov 27 '15 at 14:45