0

I just downloaded VSCode on my Mac as well as Python and pip. I downloaded the latest version of Python via VS Microsoft extensions and installed pip using Python -m ensurepip --upgrade. I have python 2.7.16 on my Mac as well, I believe from my OS (it's not something I downloaded). I am trying to use pip and Python in VSCode. I have my interpreter in my virtual environment set to Python 3.8.2, and I created the virtual environment using "python3 -m venv .venv". However, every time I check the python version (with Python --version) in the terminal, it returns Python 2.7.16. I check the pip version, and there is no command found. When I check the pip3 version, I get back the following warning:

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. You can invoke Python with '-m pip' instead of running pip directly to avoid this problem. pip 21.3.1 from /Users/username/Library/Python/3.8/lib/python/site-packages/pip (python 3.8)

Whenever I run Python -m pip or Python -m pip3, it returns "no module named pip".

When installing Python, I got a warning that Python 3 was not on the PATH, but it did not fix the issue when I tried to add the path. Unfortunately, I don't have much experience adding a path so I may have done that incorrectly.

Finally, I installed streamlit via pip3. It resulted in the following message but seemed to install. However, it could not be resolved when I tried to import streamlit in my code.

WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. You can invoke Python with '-m pip' instead of running pip directly to avoid this problem. Defaulting to user installation because normal site packages is not writeable

How do I add Python 3 to my PATH and ensure that VSCode runs Python 3 instead of 2?

Kofi
  • 1,224
  • 1
  • 10
  • 21
pops101
  • 3
  • 2
  • 1
    please check[here](https://stackoverflow.com/questions/48135624/how-can-i-change-the-python-version-in-visual-studio-code) – Kofi Jan 28 '22 at 18:38

1 Answers1

1

Simply always refer 'python3' rather than 'python'.

python3 --version
python3 -m pip install blahblahblah
Aaron Lei
  • 96
  • 4
  • Thanks for the quick answer. I installed streamlit with python3 -m pip install streamlit, however it's still not callable in my virtual environment. I don't think python3/streamlit are in the right directory. Any other suggestions? – pops101 Jan 21 '22 at 01:24