How do I integrate python 3 into the terminal without using a third party program, on a mac

Ive got a mac, and as apart of the python curriculum we are supposed to download and open pipenv to learn how to use it. (pipenv being pip’s virtual environment settup ) I got pip downloaded and integrated with the terminal using the official python manual’s guide, but I cannot readily find out how to update the version of python the terminal operates with. now with os catalina when I open the python supporting receptacle within the terminal I see this:

WARNING: Python 2.7 is not recommended.

This version is included in macOS for compatibility with legacy software.

Future versions of macOS will not include Python 2.7.

Instead, it is recommended that you transition to using ‘python3’ from within Terminal.

this language would suggest it’s possible to integrate the python update into the terminal without using something like homebrew (yuck), and integration clearly can be accomplished (the following is from what I witnessed in the codecademy lesson):

I cannot use any of the tools the python update downloaded from the official site supplied to do so, and simple aliasing or prepending things to the PATH hasn’t worked for me so far. Also I know its possible to get (a potentially antiquated version of) pipenv alright without getting python 3 (3.8) integrated but at this point It has become my mission to get it integrated. How is it done? I am not really open to using something like homebrew, I would rather just create a linux environment if homebrew is the only option, but If my opinions of homebrew are baseless I’d be happy to hear it.

so to be explicit, I want to know how to make the terminal in mac use python 3.8 as it’s default so when I download python packages they are the ones for python 3.8, and so I can use the full extent of pythons abilities on my computer, as in applied onto my computer (as thats the only reason I can imagine python is pre-installed as apart of the shell and not exclusively coded in a coding app). or if this is not the right approach what the right approach is. **warning: I’ve sunk close to 30 hours into troubleshooting this, learning this stuff is a process If you don’t have prior experience with these things, and it seems unexpectedly hopeless.

the relative lesson

The output in your terminal is suggesting that when you’re running pip --version it’s pulling pip from the Python 3.7 installation.

I am assuming that your question, slightly lost in the body of your post as it is, is essentially “how can I run python 3 without any extra stuff”?

In which case, the answer is simple: type python3 into the terminal instead of just python.

thanks for your input, anything helps this is undoubtedly a brutal question. I reworded the question to be more clear, and typing python 3 into the terminal doesn’t work for me

/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/ can't open file '3': [Errno 2] No such file or directory

when I have python 3.8 downloaded and in my .bash_profile I have this:

export PATH
export PATH="/usr/local/bin:$PATH"

not part of, your shell isn’t something that you install things into
you can install programs, and you can run programs from your shell, the shell and the programs are entirely separate things.
integrate is probably the wrong word here.

if you want a particular version of python to run when you type “python” then make sure that version is the first one found on your PATH

prepend if you want to override

That is enlightening. this issue took some it’s shape from an instance when I opened a python file in visual studio code. As is protocol vsc then prompted me to install all relative dependencies [sic, possibly], which in this case was pip… and a linter? regardless no pipenv. so I clicked onto vsc’s extensions library / market and pipenv wasn’t there. so If I download pipenv from the web where does it go? how do I set it up right? do I need to get it to be recognized by the terminal so i can use pipenv commands, so I can control it and control what gets applied to the virtual environment?

also thank you for noticing the “appending” diction error. To my understanding "export PATH= " prepends, which is what I have done. I listed my .bash_profile additions in my reply to thepitycoder

'python3' != 'python 3'

Typing python 3 is asking Python to open a file called 3. The entire command python3 has no spaces in it…

pipenv is a Python extension, why would it be in Visual Studio Code?

To install pipenv you can do either:
brew install pipenv which installs pipenv using Homebrew (which I believe is a package manager for MacOS)


pip install --user pipenv if you don’t want to use Homebrew. This installs pip to your user directory, so you might need to adjust the PATH as explained in the docs.

If pipenv is expected to be installed then same as in a shell, such an executable would be expected to be found in PATH. This would be the PATH provided to vscode, not the one you have in your shell.
Where it goes depends on how you install it … since installing is putting it somewhere.

do you know which extensions are available on the vscode market / library? you are saying I’m wrong but not telling me why. thepitycoder, I do not need your guff right now

I know I place pipenv in an exact position when I download it, but to my knowledge prepending the correct path to python 3.8 onto PATH hasn’t worked to accomplish overriding the systems relevant default initiative. As far as I know, just because I know where pipenv is doesn’t mean I will be able to access it properly. but thanks for your contributions up to this point, they’ve all been furthering. I’m gonna regroup and attempt this independently.

There’s no concept of default.
The locations in PATH is searched in order. If it’s on there, and if it’s the first one matching, then that’s what you’ll get. If it didn’t “work” then it wasn’t done. For example, maybe the content of the file you’re editing isn’t executed, maybe because it never is, or because you’re not carrying out the step during which it gets executed (for example opening a new shell or even logging in and out)… It’s easy enough to verify by printing out the variable to see whether you’ve got the modification you made in it.

The Visual Studio Code Extensions library contains extensions for Visual Studio Code. That’s why it contained the Python extension, to make VSC understand the syntax of the language, and linters which allow VSC to help you with formatting.

pipenv is a Python package, not an extension for VSC…

Installing packages, even with Visual Studio Code installed, means using pip.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.