在Ubuntu上使用virtualenv为python3设置虚拟环境

在Ubuntu上使用virtualenv为python3设置虚拟环境

问题描述:

按照网站上的说明,我想为此学习Django。 ,您需要创建一个虚拟环境。我已经听到足够多关于人们破坏操作系统的恐怖故事,因为他们没有正确设置虚拟环境,所以可以肯定地说我很偏执。

I want to learn Django so for that, as per the instructions on the website, you need to create a virtual environment. I've heard enough horror stories about people corrupting their OS cause they didn't set up the virtual environments properly so it's safe to say I'm sufficiently paranoid.

I已经在Academics / CS / VirtualENV处创建了一个单独的文件夹/目录VirtualE,我想在那里创建所有虚拟环境。根据网站,应使用以下命令-

I've created a separate folder/directory VirtualE at located at Academics/CS/VirtualENV and I want to create all my virtual environments there. As per the website, the following command should be used -

virtualenv --python=`which python3` ~/.virtualenvs/djangodev

我不确定我应该写些什么代替单引号(python3的哪个部分)。我写了以下内容-

I'm not sure what exactly I should write in place of the single quotes (the which python3 part). I wrote the following -

virtualenv --python=3.5.2 ~/Academics/CS/VirtualENV/DjangoDev

它说

The path 3.5.2 (from --python=3.5.2) does not exist

确切的位置

在命令行中,键入 which python3,它将为您提供python3的路径。您只需要复制并粘贴到命令中即可。例如:

In the command line, type "which python3" and it will give you the path to python3. You just need to copy and paste that in the command. For example:

virtualenv --python=/path/to/python3/bin/python ~/Academics/CS/VirtualENV/DjangoDev