Anaconda3+Python3+django开发环境配置(一)
【本节知识点】:
Anaconda配置python3
配置虚拟环境 venv
1、启动Anaconda Prompt
01.jpg
(base) C:\Users\Administrator>
2、安装虚拟环境导D盘(默认工作路径在C盘)如下:
(base) C:\Users\Administrator>conda create --prefix=D:\studio\Workspace\py36venv python=3.6
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: D:\studio\Workspace\py36venv
added / updated specs:
- python=3.6
The following NEW packages will be INSTALLED:
certifi pkgs/main/win-64::certifi-2019.11.28-py36_1
pip pkgs/main/win-64::pip-20.0.2-py36_1
python pkgs/main/win-64::python-3.6.10-h9f7ef89_1
setuptools pkgs/main/win-64::setuptools-46.1.1-py36_0
sqlite pkgs/main/win-64::sqlite-3.31.1-he774522_0
vc pkgs/main/win-64::vc-14.1-h0510ff6_4
vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.16.27012-hf0eaf9b_1
wheel pkgs/main/win-64::wheel-0.34.2-py36_0
wincertstore pkgs/main/win-64::wincertstore-0.2-py36h7fe50ca_0
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate D:\studio\Workspace\py36venv
#
# To deactivate an active environment, use
#
# $ conda deactivate
(base) C:\Users\Administrator>
3、切换工作路径导D盘
(base) C:\Users\Administrator>cd c:\
(base) c:\>D:
(base) D:\>cd studio\Workspace
(base) D:\studio\Workspace>dir
驱动器 D 中的卷是 D盘_工作数据
卷的序列号是 D864-7513
D:\studio\Workspace 的目录
2020-03-25 11:03 <DIR> .
2020-03-25 11:03 <DIR> ..
2019-12-31 08:33 <DIR> eclipse_python
2020-03-25 11:04 <DIR> py36venv
0 个文件 0 字节
4 个目录 4,922,478,592 可用字节
(base) D:\studio\Workspace>
4、测试3.6环境
(base) D:\studio\Workspace>cd py36venv
(base) D:\studio\Workspace\py36venv>pyton
'pyton' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
(base) D:\studio\Workspace\py36venv>python
Python 3.6.10 |Anaconda, Inc.| (default, Mar 23 2020, 17:58:33) [MSC v.1916 64 bit (AMD64)] on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
Type "help", "copyright", "credits" or "license" for more information.
>>>
5、启动虚拟工作环境
(base) D:\studio\Workspace>conda activate d:\studio\Workspace\py36venv
(d:\studio\Workspace\py36venv) D:\studio\Workspace>
错误的命令
(base) D:\studio\Workspace>conda activate py36venv
Could not find conda environment: py36venv
You can list all discoverable environments with `conda info --envs`.
6、退出虚拟工作环境
(d:\studio\Workspace\py36venv) D:\studio\Workspace>deactivate
DeprecationWarning: 'deactivate' is deprecated. Use 'conda deactivate'.
(d:\studio\Workspace\py36venv) D:\studio\Workspace>conda.bat deactivate
(base) D:\studio\Workspace>
注意错误的命令
(d:\studio\Workspace\py36venv) D:\studio\Workspace>deactivate py36venv
DeprecationWarning: 'deactivate' is deprecated. Use 'conda deactivate'.
(d:\studio\Workspace\py36venv) D:\studio\Workspace>conda.bat deactivate py36venv
deactivate does not accept arguments
remainder_args: ['py36venv']
下面也是错误命令
(d:\studio\Workspace\py36venv) D:\studio\Workspace>deactivate D:\studio\Workspace\py36venv
DeprecationWarning: 'deactivate' is deprecated. Use 'conda deactivate'.
(d:\studio\Workspace\py36venv) D:\studio\Workspace>conda.bat deactivate D:\studio\Workspace\py36venv
deactivate does not accept arguments
remainder_args: ['D:\\studio\\Workspace\\py36venv']
【温馨提示】其实Django开发可以不用Ananconda3,直接下载安装Python3 + Django即可,而且相比本文安装更为简洁。安装配置方法类似,读者可做参考。
网友评论