[英]Creating Virtual environment using python 3.8 when python 2.7 is present
I am trying to create a virtual environment using mkvirtualenv with python 3 in Windows but the environment is created with python 2.7.My pip version is also from python 2.7 which i have avoided using I am trying to create a virtual environment using mkvirtualenv with python 3 in Windows but the environment is created with python 2.7.My pip version is also from python 2.7 which i have avoided using
py -m pip install virtualenvwrapper-win
When i do当我做
mkvirtualenv test
environment is created with python 2.7 Please help me with a solution Thanks in advance:)环境是使用 python 2.7 创建的,请帮助我解决方案 在此先感谢:)
If you would like to create a virtualenv with python 3.X
having the version 2.X
如果你想用
python 3.X
创建一个 virtualenv 版本为2.X
You just have to pass a parameter argument for your virtual env.您只需为您的虚拟环境传递一个参数参数。
$ virtualenv venv -p $(which python3)
This command will point to your current python3 install folder, and create a virtualenv copied from your current python3 binaries.此命令将指向您当前的 python3 安装文件夹,并创建一个从当前 python3 二进制文件复制的 virtualenv。
If you would like to see what this command does, just fire the command:如果您想查看此命令的作用,只需触发命令:
$ which python3
#should print your current python3 binary folder.
you need install python3.8 to your enviroment, if you are in ubuntu(18.04):如果您在 ubuntu(18.04) 中,则需要将 python3.8 安装到您的环境中:
sudo apt install python3.8
and:和:
mkvirtualenv name_of_the_project -p python3.8
Does:做:
python3 -m venv venv
solve your problem?解决你的问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.