Python(1)
关键词:
python anaconda conda pycharm关系
package management, virtual environment
Anaconda
是一个打包的集合,里面预装好了conda、某个版本的python、各种packages等
Conda
conda其核心功能是包管理和环境管理。
pycharm
是python IDE 集成开发环境(IDE:Integrated Development Environment)
Conda
conda其核心功能是包管理和环境管理。
-
package management
python用于不同目的projects时会用到不同的package(如图:flask,matplotlib,pytorch)
不同版本的python(eg.python3.5<>3.7)
包管理与pip的使用方法类似 -
virtual environment
the problem might be that You don’t have one single project in python you might have multiple projects for multiple purposes and you have all these packages installed globally on your machine.
the solution here is that we basically have an unlimited amount of computers on our single computer by using so-called virtual environments and these environments let us do exactly what you can see right here we can create separate environments for each purpose of python
Conda VS pip
Conda is a cross platform package and environment manager that installs and manages conda packages from the Anaconda repository as well as from the Anaconda Cloud. Conda packages are binaries. There is never a need to have compilers available to install them. Additionally conda packages are not limited to Python software. They may also contain C or C++ libraries, R packages or any other software.
This highlights a key difference between conda and pip. Pip installs Python packages whereas conda installs packages which may contain software written in any language. For example, before using pip, a Python interpreter must be installed via a system package manager or by downloading and running an installer. Conda on the other hand can install Python packages as well as the Python interpreter directly.
https://www.anaconda.com/blog/understanding-conda-and-pip
compiler 编译器 python interpreter 解释器
![python interpreter 解释器
https://www.youtube.com/watch?v=23aQdrS58e0
Terminal
打开terminal 输入conda list
this list simply shows us all the default packages that were installed when we installed anaconda
输入 conda env list
a list of our environments that we have at the moment we have the default environment this base environment right here
and we are currently working in this environment *
还有自己之前create 的environment(没有命名?, path为D:\INT104)
创建新环境
me其实就是pycharm里面的新建python file
(名为ai37,python版本3.7)
成功后conda env list
可以看到envionment list 中有ai37通过 conda activate ai37 进入该环境
查看conda list(package list&versions), 发现python3.7 在其中
添加package
如果在default有这个package,则可以直接install。
成功后可以在conda list 中显示
如果没有,则用另外的方法 比如先建立channel再下载
conda config --add channels torch
记住是两个**-**
总结
python环境搭建完整过程
https://www.runoob.com/python/python-install.html
环境变量配置
程序和可执行文件可以在许多目录,而这些路径很可能不在操作系统提供可执行文件的搜索路径中。
path(路径)存储在环境变量中,这是由操作系统维护的一个命名的字符串。这些变量包含可用的命令行解释器和其他程序的信息。
Unix或Windows中路径变量为PATH(UNIX区分大小写,Windows不区分大小写)
运行python
cmd、pycharm(IDE)