【Django】anaconda环境变量配置及配置python虚拟环境

文章目录

配置环境变量

cmd 复制代码
control sysdm.cpl,,3
  • 笔者anaconda安装目录为C:\ProgramData\anaconda3
    那么需要加入path中的有如下三个
    C:\ProgramData\anaconda3
    C:\ProgramData\anaconda3\Scripts
    C:\ProgramData\anaconda3\Library\bin

配置python虚拟环境

首先进入base环境

cmd 复制代码
conda create -n mydjango python

查看列表

cmd 复制代码
conda env list

激活

cmd 复制代码
conda activate mydjango

如果不小心弄错了,删除方法如下:

conda 复制代码
conda remove --name mydjango --all

查看conda源并配置国内源

  1. 查看已经存在的镜像源
bash 复制代码
conda config --show channels
  1. 添加清华大学镜像源
cmd 复制代码
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch

https://mirrors.tuna.tsinghua.edu.cn/help/pypi/

cmd 复制代码
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

在虚拟环境中安装django

python 复制代码
pip install django
相关推荐
程序设计实验室5 小时前
当人人都能用 AI 写代码时,我为什么选择重回 Django?
django·djangostarter
zone77395 小时前
001:简单 RAG 入门
后端·python·面试
F_Quant5 小时前
🚀 Python打包踩坑指南:彻底解决 Nuitka --onefile 配置文件丢失与重启报错问题
python·操作系统
允许部分打工人先富起来6 小时前
在node项目中执行python脚本
前端·python·node.js
IVEN_6 小时前
Python OpenCV: RGB三色识别的最佳工程实践
python·opencv
haosend7 小时前
AI时代,传统网络运维人员的转型指南
python·数据网络·网络自动化
曲幽7 小时前
不止于JWT:用FastAPI的Depends实现细粒度权限控制
python·fastapi·web·jwt·rbac·permission·depends·abac
IVEN_1 天前
只会Python皮毛?深入理解这几点,轻松进阶全栈开发
python·全栈
Ray Liang1 天前
用六边形架构与整洁架构对比是伪命题?
java·python·c#·架构设计
AI攻城狮1 天前
如何给 AI Agent 做"断舍离":OpenClaw Session 自动清理实践
python