Linux 如何从命令行下载python?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6630873/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 05:00:57  来源:igfitidea点击:

How to download python from command-line?

pythonlinuxcommand-linedownload

提问by Python

I'm on windows, but I'm using a putty shell to connect to a linux machine, and want to install python 2.7. Can't figure out how to do it. How can I download python from command line?

我在 Windows 上,但我正在使用腻子外壳连接到 linux 机器,并且想要安装 python 2.7。无法弄清楚该怎么做。如何从命令行下载python?

采纳答案by Andrew Clark

wget --no-check-certificate https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
tar -xzf Python-2.7.11.tgz  
cd Python-2.7.11

Now read the READMEfile to figure out how to install, or do the following with no guarantees from me that it will be exactly what you need.

现在阅读该README文件以了解如何安装,或者在我不保证它正是您需要的情况下执行以下操作。

./configure  
make  
sudo make install  

For Python 3.5 use the following download address:
http://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz

对于 Python 3.5 使用以下下载地址:http:
//www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz

For other versions and the most up to date download links:
http://www.python.org/getit/

对于其他版本和最新的下载链接:http:
//www.python.org/getit/

回答by odrm

apt-get install python2.7will work on debian-like linuxes. The python websitedescribes a whole bunch of other ways to get Python.

apt-get install python2.7将在类似 debian 的 linux 上工作。该蟒蛇网站介绍了一大堆其他方式获得的Python。

回答by Hassek

Well if you are getting into a linux machine you can use the package manager of that linux distro.

好吧,如果您要使用 linux 机器,则可以使用该 linux 发行版的包管理器。

If you are using Ubuntu just use apt-get search python, check the list and do apt-get install python2.7 (not sure if python2.7 or python-2.7, check the list)

如果您使用的是 Ubuntu,只需使用 apt-get search python,检查列表并执行 apt-get install python2.7(不确定是 python2.7 还是 python-2.7,检查列表)

You could use yum in fedora and do the same.

您可以在 Fedora 中使用 yum 并执行相同的操作。

if you want to install it on your windows machine i dont know any package manager, i would download the wget for windows, donwload the package from python.org and install it

如果你想在你的 Windows 机器上安装它,我不知道任何包管理器,我会下载 wget for windows,从 python.org 下载包并安装它