简体   繁体   English

“ conda install python = 3.6”和“ apt install python = 3.6”之间的区别?

[英]difference between “conda install python=3.6” and “apt install python=3.6”?

Context: I have python 3.7 on my computer (Linux). 上下文:我在计算机(Linux)上安装了python 3.7。 Some package (tensorflow) needs a previous version of python to function. 某些软件包(tensorflow)需要python的早期版本才能运行。

In this post , a user suggested to install a previous version of python using the command: 这篇文章中 ,用户建议使用以下命令安装python的早期版本:

 conda install python=3.6

I am confused by this command, since I normally install python using apt or apt-get ( I am on ubuntu ). 我对这个命令感到困惑,因为我通常使用apt或apt-get安装python(我在ubuntu上)。 I think of python as being separate from anaconda. 我认为python与anaconda分开。

 apt install python=3.6

What is the difference between these two commands? 这两个命令有什么区别?

What you might want to do if you need a specific version of Python for a particular project is making a 'virtual environment'. 如果您需要为特定项目使用特定版本的Python,那么您可能想做的就是制作“虚拟环境”。 Basically, that means that pip packages are installed within the project folder rather than in your bin folder somewhere on your computer. 基本上,这意味着pip包安装在项目文件夹中,而不是安装在计算机上的bin文件夹中。 Virtual environment can also link to a version of python using something like virtualenv --python=/usr/bin/python2.6 . 虚拟环境还可以使用virtualenv --python=/usr/bin/python2.6类的东西链接到python版本。

apt install python=3.6 will install in the standard bin folder of your distro. apt install python=3.6将安装在发行版的标准bin文件夹中。

conda install python=3.6 will check in which environment you currently are and install it there. conda install python=3.6将检查您当前所在的环境并将其安装在此处。 It of course requires Anaconda installed and setup on your computer. 当然,这需要在计算机上安装和设置Anaconda。

There are a lot of virtual environment management packages out there and I am not going to give an opinion on which is the best. 有很多虚拟环境管理软件包,我不会就哪个是最好的发表意见。

Note that if you install it using apt install , the version used in command line for python3 or python may be ambiguous, to be sure, you can specify the full path or make an alias for that path if there isn't one. 请注意,如果使用apt install ,则在python3python命令行中使用的版本可能是模棱两可的,可以肯定的是,您可以指定完整路径或为该路径创建别名(如果没有)。

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

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