Configuring Python Virtual Environment to use Python 3

拟墨画扇 提交于 2019-12-01 14:48:35

Virtualenv with python 2

virtualenv myEnv

Virtualenv with python 3

virtualenv -p python3 myEnv

If you are on Linux just use the command python3 -m venv myvenv in the directory of your project and you're done!

Execute below command line:->

For Python3 :->

virtualenv --python = $(which python3) EnvironmentName

For Python2 :->

virtualenv --python = $(which python) EnvironmentName

If you want to use Python 3, the recommended way to create a virtual environment is using python3 -m venv as follows:

python3 -m venv venv # this will create a virtual environment called venv

In your case, you can directly use python instead of python3 since you have already configured your laptop to use Python 3 when running python (this is shown in your question).

In Windows, to activate this virtual environment run the following:

venv\Scripts\activate.bat

That's it!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!