Command Line Problems After Installing PIPENV

I just finished following along the pipenv tutorial (https://www.codecademy.com/courses/learn-python-3/articles/learn-python-pipenv) and I had no issues. But now I am not able to use my terminal correctly. I exited out of the shell and pipenv itself. But it’s not allowing me to use the ‘ls’ command, and when I try to edit my ~/.bash_profile, it says Permission denied. On another forum, someone suggested using this:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

That makes ‘ls’ work temporarily, but not after I restart the terminal. I’m guessing this is a path issue but I’m afraid to mess around with anything further. I would appreciate any help! (And yes, I’d already done the Learn the Command Line lesson, but I can’t find anything to help me with this issue.) Thank you!

What OS on your Mac? Catalina or Big Sur?

I updated to Monterey last week (but it’s been working fine since then until this!)

the “.” in your ~/.bash_profile denotes a hidden file.

when you do a ls at the prompt, what happens? do you get a list of files?

Since Catalina the shell has been zsh and not bash. What is your default shell?

what happens when you type ls -l ~/.bash_profile ? is the user listed, you? If not, I think you need to change the file permissions.

This might help–about halfway down the page when an answer mentions Catalina:

https://stackoverflow.com/questions/28065542/sudo-open-e-bash-profile-permission-denied-mac

I also think that this is a helpful explanation of PATH variables:

It says “command not found” when I try to do ls -l ~/.bash_profile. It says this when I do anything. I wish I hadn’t done this pipenv tutorial, because I feel like I wasn’t smart enough to understand what I was changing on the PATH. (I just followed the person’s exact instructions.) Thanks for the links! Hopefully I can figure out how to fix my path.

It can all be confusing (trust me, I still get confused at times. lol). Unless one uses the CLI all the time, it’s a totally foreign concept.

I can say that using Homebrew (a package manager) to install anything on a mac is a good place to start.
Here: https://brew.sh

This article on Medium is useful: https://medium.com/@norton.seanm/change-from-bash-to-zsh-on-mac-80b034d827d4

Thanks so much for your input! The problem is that everything was working totally fine Friday! Once I followed the pipenv tutorial, it’s like it’s broken. I’m not even able to follow that homebrew tutorial because it just keeps telling me the command not found. It’s stuck inside of something?

1 Like

I tried this:

echo $PATH

And this is what came up. Does this mean I’m stuck in Python?

/Library/Frameworks/Python.framework/Versions/3.10/bin:/Users/nicoletow8/Library/Python/3.10/bin

type: exit()

to get out of the python shell.

oops, CTRL C

Yeeeaaa, that part of the course needs more explanation and to be updated…IMO.

1 Like

I did try exit() but it still didn’t work.

This link told me to find the bash_profile on my computer and comment out all of the export PATH lines. That worked!!

Thank you again, Lisa, for all of your help. It helped me work through the problem!

2 Likes

Oh, whew! Good! Glad you got it fixed. :slight_smile:

2 Likes

Me too - thanks! And with the help of your link, I can now figure out zsh! Ha!

2 Likes