0

I tried some guides that I found but nothing works. I need this virtual env for a telegram bot. I| use Visual studio code

scorpio11
  • 1
  • 2
  • 2
  • Does this answer your question? [What is a virtualenv, and why should I use one?](https://stackoverflow.com/questions/41972261/what-is-a-virtualenv-and-why-should-i-use-one) – Code-Apprentice Feb 02 '22 at 19:57
  • 2
    "I tried some guides that I found but nothing works." We can better help you solve the specific problems you encountered if you tell us what they are. [Edit] your question to include more details such as what steps you took and what happened at each step. If there is an error, I suggest googling that error to see what other people already did to solve it. – Code-Apprentice Feb 02 '22 at 19:59

3 Answers3

0

How to install virtualenv: Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 

Now create a virtual environment

virtualenv venv 

you can use any name insted of venv

You can also use a Python interpreter of your choice

virtualenv -p /usr/bin/python2.7 venv

Active your virtual environment:

source venv/bin/activate

Using fish shell:

source venv/bin/activate.fish

To deactivate:

deactivate

Create virtualenv using Python3

virtualenv -p python3 myenv

Instead of using virtualenv you can use this command in Python3

python3 -m venv myenv
tomerar
  • 805
  • 5
  • 10
0
  1. Install. To create a virtual environment, use the following command, where .venv is the name of the environment folder:
python -m venv .venv
  1. Activate. When you create a new virtual environment, a prompt will be displayed to allow you to select it for the workspace.

This will add the path to the Python interpreter from the new virtual environment to your workspace settings. That environment will then be used when installing packages and running code through the Python extension.

You can switch environments at any time at the bottom left corner of VS Code window or using the Python: Select Interpreter command from the Command Palette (Ctrl+Shift+P).

Rykov7
  • 11
  • 3
0

Its looks like your problem is activating the virtual environment.

source env/bin/activate

or just type activate in your terminal.

If you are using windows try:-

env\Scripts\activate.bat
shamnad sherief
  • 552
  • 5
  • 17