set virtual environment in python 2 and python 3
beginners how to create an virtual enviroment this site
Install pip first and upgrade it
$ sudo -H pip3 install –upgrade pip
$ sudo -H pip2 install –upgrade pip
$ 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
if this error below shows below do the procdures below
Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-byumuvvr/termcolor/
122
down vote
About the error code
According to python documentation:
This module makes available standard errno system symbols. The value of each symbol is the corresponding integer value. The names and descriptions are borrowed from linux/include/errno.h, which should be pretty all-inclusive.
Error code 1 is defined in errno.h and means Operation not permitted.
About your error
Your setuptools do not appear to be installed. Just follow the Installation Instructions from the pypi website.
If it’s already installed, try
pip install –upgrade setuptools
If it’s already up to date, check that the module ez_setup is not missing. If it is, then
pip install ez_setup
Then try again
pip install unroll
If it’s still not working, maybe pip didn’t install/upgrade setup_tools properly so you might want to try
easy_install -U setuptools
and again
pip install unroll
********Important note*******put sudo before pip or pip3 installation
Nguồn:https://ftlinuxcourse.com/
Xem Thêm Bài Viết Khác:https://ftlinuxcourse.com/lap-trinh-linux
Comments