访问码:搞技术,最怕的就是别人比你强,而且还比你努力!!!
1、VsCode概述
使用Visual Studio Code起步并运行起来既快又简单。这是一个小的下载,所以你可以在几分钟内安装,并尝试VS码,VS Code是一个可在macOS,Linux和Windows操作系统上运行的免费代码编辑器。VS Code是轻量级的,应该在大多数可用的硬件和平台版本上运行。您可以查看系统要求以检查您的计算机配置是否受支持。
Vscode下载地址:https://code.visualstudio.com/
2、ConEmu概述
ConEmu-Maximus5旨在成为方便,全面,快速和可靠的终端窗口,您可以托管任何 为WinAPI(cmd,powershell,far)或Unix PTY(cygwin,msys,wsl bash)开发的控制台应用程序。
作为Windows控制台窗口增强(本地终端仿真器),ConEmu将多个控制台和简单的GUI应用程序(例如PuTTY)作为一个 具有各种功能的可定制选项卡式GUI窗口提供。此外,由于深度集成,ConEmu是Far Manager (维基百科中的FAR)的最佳伴侣 ,我最喜欢的外壳替代品。ConEmu是一个积极的项目,对建议持开放态度。
ConEmuc下载地址:https://conemu.github.io/
解释:以上概述均为官方介绍,我们发现VsCode就是一个代码的编辑器,那么我们可以理解为Pycharm这一类型的代码编辑器,那么我们使用VsCode来进行写代码,当然它有很多的优点。那么ConEmuC呢就是我们的windows的cmd终端 但是我们为什么要使用ConEmuC 我们接下来会发现它要比windows默认的cmd要好很多。
3、安装好VsCode如下:
当我们第一次打开的时候,它会提示缺少Git 所以我们需要安装,那么这边我已经安装好了,所以这里不再演示。
ConEmuC如下:
注意安装完成后需要设置ConEmu的环境变量
我们看最上方可以去添加很多个cmd终端,无论是外形 字体 包括功能方面要比windows默认的cmd终端要好很多,那么我们现在在看一下windows的默认cmd终端如下:
确实现在两个比起来大家都懂得~ 我们就可以把ConEmuC理解为一个非常不错的模仿cmd终端的软件就可以了。
注意:在安装Anaconda的时候我们在最后添加环境变量如下:
安装完成后我们打开ConEmu终端-->输入conda
C:\Users\Yankerp>conda
usage: conda [-h] [-V] command ...
conda is a tool for managing and deploying applications, environments and packages.
Options:
positional arguments:
command
clean Remove unused packages and caches.
config Modify configuration values in .condarc. This is modeled
after the git config command. Writes to the user .condarc
file (C:\Users\Yankerp\.condarc) by default.
create Create a new conda environment from a list of specified
packages.
help Displays a list of available conda commands and their help
strings.
info Display information about current conda install.
install Installs a list of packages into a specified conda
environment.
list List linked packages in a conda environment.
package Low-level conda package utility. (EXPERIMENTAL)
remove Remove a list of packages from a specified conda environment.
uninstall Alias for conda remove. See conda remove --help.
search Search for packages and display associated information. The
input is a MatchSpec, a query language for conda packages.
See examples below.
update Updates conda packages to the latest compatible version. This
command accepts a list of package names and updates them to
the latest versions that are compatible with all other
packages in the environment. Conda attempts to install the
newest versions of the requested packages. To accomplish
this, it may update some packages that are already installed,
or install additional packages. To prevent existing packages
我们会发现Conda是一个命令,那么这个命令是用来创建Python的模拟开发环境的。
1、列出当前所有的环境
C:\Users\Yankerp>conda env list
# conda environments:
#
base * C:\Users\Yankerp\Miniconda3
我们在这里只看大了base 那么说明我们目前没有环境,那么我们创建一个Python的虚拟环境如下:
C:\Users\Yankerp>conda create -n py3 python=3
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.4.10
latest version: 4.5.4
Please update conda by running
$ conda update -n base conda
## Package Plan ##
environment location: C:\Users\Yankerp\Miniconda3\envs\py3
added / updated specs:
- python=3
The following NEW packages will be INSTALLED:
certifi: 2018.4.16-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pip: 10.0.1-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
python: 3.6.5-h0c2934d_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
setuptools: 39.1.0-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
vc: 14-h0510ff6_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
vs2015_runtime: 14.0.25123-3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
wheel: 0.31.1-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
wincertstore: 0.2-py36h7fe50ca_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
解释:Conda create(创建) -n py3(起个别名为:py3) python=3(指定python版本为3.x)
2、创建完成如下:
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use:
# > activate py3
#
# To deactivate an active environment, use:
# > deactivate
#
# * for power-users using bash, you must source
#
C:\Users\Yankerp
使用创建好的环境
C:\Users\Yankerp>conda env list
# conda environments:
#
base * C:\Users\Yankerp\Miniconda3
py3 C:\Users\Yankerp\Miniconda3\envs\py3
创建完成后我们看到了刚刚创建的py3 那么我们如何去用它? 如下:
C:\Users\Yankerp>conda env list
# conda environments:
#
base * C:\Users\Yankerp\Miniconda3
py3 C:\Users\Yankerp\Miniconda3\envs\py3
C:\Users\Yankerp>activate py3
(py3) C:\Users\Yankerp>pip freeze
certifi==2018.4.16
wincertstore==0.2
(py3) C:\Users\Yankerp>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
3、我们可以看到此环境就是Python3.6.5,那么比如我们在创建一个Python环境是2.7的 如下:
C:\Users\Yankerp>conda create -n py2 python=2
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.4.10
latest version: 4.5.4
Please update conda by running
$ conda update -n base conda
## Package Plan ##
environment location: C:\Users\Yankerp\Miniconda3\envs\py2
added / updated specs:
- python=2
The following NEW packages will be INSTALLED:
certifi: 2018.4.16-py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pip: 10.0.1-py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
python: 2.7.15-he216670_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
setuptools: 39.1.0-py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
vc: 9-h7299396_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
vs2008_runtime: 9.00.30729.1-hfaea7d5_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
wheel: 0.31.1-py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
wincertstore: 0.2-py27hf04cefb_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
Proceed ([y]/n)?
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
创建成果后查看当前的环境
C:\Users\Yankerp>conda env list
# conda environments:
#
base * C:\Users\Yankerp\Miniconda3
py2 C:\Users\Yankerp\Miniconda3\envs\py2
py3 C:\Users\Yankerp\Miniconda3\envs\py3
C:\Users\Yankerp>activate py2
(py2) C:\Users\Yankerp>python
Python 2.7.15 |Anaconda, Inc.| (default, May 1 2018, 18:37:09) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
那么从上图来说,目前我们就有了两个终端了,那么我们想在Python3.6.5中的这个环境安装Django框架如下:
(py3) C:\Users\Yankerp>conda install django
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.4.10
latest version: 4.5.4
Please update conda by running
$ conda update -n base conda
## Package Plan ##
environment location: C:\Users\Yankerp\Miniconda3\envs\py3
added / updated specs:
- django
The following NEW packages will be INSTALLED:
django: 2.0.2-py36hd476221_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pytz: 2018.4-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
Proceed ([y]/n)?
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(py3) C:\Users\Yankerp>
查看当前环境下安装的程序
(py3) C:\Users\Yankerp>pip freeze
certifi==2018.4.16
Django==2.0.2
pytz==2018.4
wincertstore==0.2
(py3) C:\Users\Yankerp>
4、我们直接创建开发环境指定安装Django
C:\Users\Yankerp>conda create -n py3-Djo python=3 django=2
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.4.10
latest version: 4.5.4
Please update conda by running
$ conda update -n base conda
## Package Plan ##
environment location: C:\Users\Yankerp\Miniconda3\envs\py3-Djo
added / updated specs:
- django=2
- python=3
The following NEW packages will be INSTALLED:
certifi: 2018.4.16-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
django: 2.0.5-py36hd476221_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pip: 10.0.1-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
python: 3.6.5-h0c2934d_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pytz: 2018.4-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
setuptools: 39.2.0-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
vc: 14-h0510ff6_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
vs2015_runtime: 14.0.25123-3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
wheel: 0.31.1-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
wincertstore: 0.2-py36h7fe50ca_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
创建完成后查看当前的环境
C:\Users\Yankerp>conda env list
# conda environments:
#
base * C:\Users\Yankerp\Miniconda3
py2 C:\Users\Yankerp\Miniconda3\envs\py2
py3 C:\Users\Yankerp\Miniconda3\envs\py3
py3-Djo C:\Users\Yankerp\Miniconda3\envs\py3-Djo
C:\Users\Yankerp>activate py3-Djo
(py3-Djo) C:\Users\Yankerp>pip freeze
certifi==2018.4.16
Django==2.0.5
pytz==2018.4
wincertstore==0.2
(py3-Djo) C:\Users\Yankerp>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print ("hello world")
hello world
>>>
5、删除环境(删除Py3-Djo环境)
C:\Users\Yankerp>conda env list
# conda environments:
#
base * C:\Users\Yankerp\Miniconda3
py2 C:\Users\Yankerp\Miniconda3\envs\py2
py3 C:\Users\Yankerp\Miniconda3\envs\py3
py3-Djo C:\Users\Yankerp\Miniconda3\envs\py3-Djo
C:\Users\Yankerp>conda remove -n py3-Djo --all
Remove all packages in environment C:\Users\Yankerp\Miniconda3\envs\py3-Djo:
## Package Plan ##
environment location: C:\Users\Yankerp\Miniconda3\envs\py3-Djo
The following packages will be REMOVED:
certifi: 2018.4.16-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
django: 2.0.5-py36hd476221_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pip: 10.0.1-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
python: 3.6.5-h0c2934d_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pytz: 2018.4-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
setuptools: 39.2.0-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
vc: 14-h0510ff6_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
vs2015_runtime: 14.0.25123-3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
wheel: 0.31.1-py36_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
wincertstore: 0.2-py36h7fe50ca_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
Proceed ([y]/n)? y
C:\Users\Yankerp>conda env list
# conda environments:
#
base * C:\Users\Yankerp\Miniconda3
py2 C:\Users\Yankerp\Miniconda3\envs\py2
py3 C:\Users\Yankerp\Miniconda3\envs\py3
6、VsCode结合ConEmu写一句代码
我们选择使用VsCode编辑器打开,打开之后呢,在PY文件此目录下调用ConEmu(Cmd)模拟器,如果调用不成功那么请您设置环境bianl
F:\Python-写一句代码>python aaa.py
加油干,python2018
whis your name:yankerp
那么到这里呢 环境都已经配置好了,那么本章就结束了,希望对您有所帮助,再见