virtualenv:错误:需要以下参数:dest [英] virtualenv: error: the following arguments are required: dest
问题描述
我无法在我的 macbook pro 上的 python3 上安装和配置虚拟环境.我试图为我的下一个项目安装和试用 django,但这里开始出现问题.
I can't install and configure virtual environment on python3 on my macbook pro. I was trying to install and try django for my next project but here problems started arising.
推荐答案
在目录下安装虚拟环境
在主目录根目录添加以下命令创建环境:
In the main directory root add the following command to create the environment:
$ python3 -m venv venv
此代码将在根目录中创建一个名为 venv 的文件夹.基本上是虚拟环境文件夹.
$ python3 -m venv venv
this code will create a folder called venv in the root. Which basically is the virtual environment folder.
然后添加以下命令激活虚拟环境:
Then add the following command to activate the virtual environment:
$ source venv/bin/activate
your_project_folder/
|
|-- your_main_app_folder/
| |
| |--Folder_with_controllers/
| | settings.py
| | urls.py
| | ...
| |
| |--App_folder/
| |--Other_app_folder/
|
|--venv/
如果代码运行良好,您的 bash 应该如下所示:
If the code works fine your bash should look like this:
(venv)
激活您的环境后,您现在可以安装 django 和其他软件包.
After activated your environment you can now install django and other packages.
ps:确保您安装并激活虚拟环境文件夹不在 your_main_app_folder 中.
p.s.: make sure you instal and activate the virtual environment folder not in the your_main_app_folder.
这篇关于virtualenv:错误:需要以下参数:dest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!