#🔒 Installing packages in VS 2022 via terminal

9 messages · Page 1 of 1 (latest)

hybrid harbor
#

Hello, I'm new here and relativly new to python but have many years of experience in MATLAB. I want to use VS 2022 and installed python, create a new project, a virtual environment and want now to install packages per terminal using the pip command. Can you tell me how can i activate the terminal, make the venv my current environment and install the package? Thank you very much., I know that this is a totally beginner question.

radiant pilotBOT
#

@hybrid harbor

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

quaint grove
#

Are you on Windows, or Linux/Mac?

scenic abyss
quaint grove
#

From the venv:
On the former you need to run .\Scripts\activate.bat
On the latter it's source ./bin/activate

Source can be replaced with . on Bash. I can't remember if it's activate.sh instead, but I don't think so, and autocompletion is your friend.

Practise it first outside of VS and outside VS Code, in a regular system terminal.

scenic abyss
#

You will have to explain at which step you are blocked or have questions when you follow a clear guide like the one I shared above.

vernal hatch
#

@hybrid harbor

  • Use python3 instead of python on Mac/Linux.
  • Use source instead of call on Mac/Linux.

Create a Venv

python -m venv <The name of your venv, usually just venv or env>

Activate your Venv

call Scripts/activate.bat
You'll know it worked when you see the name of your venv before your command line path.

Install packages

pip install <package>
The packages will now be installed in the venv instead of your site-packages.

radiant pilotBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.