I tried some guides that I found but nothing works. I need this virtual env for a telegram bot. I| use Visual studio code
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
python -m venv.venv
command in VS Code terminal in your work directory with Telegram bot . So .venv
will be a relative path to your virtual environment directory. In this case venv is created in the current directory, it may has any other name, but venv is common use. -m
key is needed to run library venv
module as a script.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.