简体   繁体   English

Python 虚拟环境帮助 - Django

[英]Python Virtual Environment Help - Django

Error Message I am struggling to install Django to my new project using pipenv, it keeps telling me to run another virtual environment rather than actually installing Django.错误消息我正在努力使用 pipenv 将 Django 安装到我的新项目,它一直告诉我运行另一个虚拟环境而不是实际安装 Django。

Please help:(请帮忙:(

I tried to do what it says to using the other virtual env but it still won't work.我尝试按照它所说的使用其他虚拟环境进行操作,但它仍然无法正常工作。

You get that all wrong.你完全错了。 "The venv module supports creating lightweight “virtual environments”, each with their own independent set of Python packages installed in their site directories. A virtual environment is created on top of an existing Python installation, known as the virtual environment's “base” Python, and may optionally be isolated from the packages in the base environment, so only those explicitly installed in the virtual environment are available. “venv 模块支持创建轻量级“虚拟环境”,每个环境都在其站点目录中安装了自己独立的一组 Python 包。虚拟环境是在现有 Python 安装之上创建的,称为虚拟环境的“基础”Python,并且可以选择与基础环境中的包隔离,因此只有明确安装在虚拟环境中的包可用。

When used from within a virtual environment, common installation tools such as pip will install Python packages into a virtual environment without needing to be told to do so explicitly."当在虚拟环境中使用时,pip 等常用安装工具会将 Python 包安装到虚拟环境中,而无需明确告知这样做。”

pip is python package manager and there for tool for installing modules such as Django. pip 是 python 包管理器,用于安装 Django 等模块的工具。 If you are running linux you can use following commands如果您正在运行 linux,则可以使用以下命令

-> cd storefront
-> python -m venv venv  (create new virtual environment name: "venv")
-> . venv/bin/activate  (to activate virtual environment) 
-> pip install django   (to install Django modules)

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

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