简体   繁体   English

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

[英]Setting up a virtual environment for python3 using virtualenv on Ubuntu

I want to learn Django so for that, as per the instructions on the website , you need to create a virtual environment. 我想学习Django,因此,按照网站上的说明,您需要创建一个虚拟环境。 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've created a separate folder/directory VirtualE at located at Academics/CS/VirtualENV and I want to create all my virtual environments there. 我已经在Academics / CS / VirtualENV中创建了一个单独的文件夹/目录VirtualE,我想在那里创建所有虚拟环境。 As per the website , the following command should be used - 根据网站 ,应使用以下命令-

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

I'm not sure what exactly I should write in place of the single quotes (the which python3 part). 我不确定应该用什么来代替单引号(python3的哪一部分)。 I wrote the following - 我写了以下内容-

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

It says 它说

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

Where exactly am I going wrong? 我到底哪里出问题了?

In the command line, type "which python3" and it will give you the path to python3. 在命令行中,输入“ which python3”,它将为您提供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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM