简体   繁体   English

Python 如何在 Django 中创建虚拟环境?

[英]Python How to create virtual environment in Django?

I am new to Python and I'm following a tutorial which requires creating a virtual environment while creating a Python project,我是 Python 新手,我正在学习一个需要在创建 Python 项目时创建虚拟环境的教程,
But I am unable to create one for some reasons,但由于某些原因我无法创建一个,
I am using the command -我正在使用命令 -

mkvirtualenv djangoenv

But it displays -但它显示 -

bash: mkvirtualenv: command not found

Most recommended using PyCharm but, as I have work on JS as well, I wish to continue using VS Code最推荐使用 PyCharm 但是,因为我也在 JS 上工作,我希望继续使用 VS Code

Following are the steps that I tried -以下是我尝试的步骤 -

在此处输入图片说明

I checked, the virtualenvwrapper is installed on my machine -我查了一下,我的机器上安装了virtualenvwrapper - 在此处输入图片说明

My ~/.bash_profile file, looks like this -我的~/.bash_profile文件,看起来像这样 -

在此处输入图片说明

在此处输入图片说明

I'd recommend looking at this answer for Mac users .我建议为 Mac 用户查看这个答案 Be sure that the $PATH is set before sourcing virtualenvwrapper.sh in your .bash_profile确保在您的.bash_profile采购virtualenvwrapper.sh之前设置了$PATH

It seems mkvirtualenv isn't installed on your system.您的系统上似乎未安装 mkvirtualenv。 First of all make sure you have python and pip installed then follow this instruction.首先确保你已经安装了 python 和 pip,然后按照这个说明进行操作。 https://pypi.org/project/virtualenvwrapper-win/ https://pypi.org/project/virtualenvwrapper-win/

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

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