在 Windows 10 的 Bash Shell 上升级 python
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42436901/
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
Upgrading python on Windows 10’s Bash Shell
提问by Ganesh Kathiresan
I was trying to update python3
in the Linux Bash Shell for Windows 10.
我试图python3
在适用于 Windows 10 的 Linux Bash Shell 中进行更新。
Here is what I tried:
这是我尝试过的:
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
But I got the following error:
但我收到以下错误:
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
Errors were encountered while processing:
ghc
E: Sub-process /usr/bin/dpkg returned an error code (1)
I also tried searching if it will override my python 3.4 and make it inaccessible as in delete it and install 3.6, but found no results.
我还尝试搜索它是否会覆盖我的 python 3.4 并使其无法访问,就像删除它并安装 3.6 一样,但没有找到任何结果。
Is there a safe way to upgrade python3
here
是否有升级安全的方式python3
在这里
[EDIT]
[编辑]
After upgrading the shell to 16.04using do-release-upgrade
, the error goes away. Update can be done following this link.
使用将 shell 升级到16.04 后do-release-upgrade
,错误消失。可以按照此链接进行更新。
回答by Rich Turner
First, I'd strongly encourage you to make sure you're running Windows 10 Fall Creators Update (or later).
首先,我强烈建议您确保您运行的是 Windows 10 Fall Creators Update(或更高版本)。
Secondly, I'd recommend adding the apt upgrade
step below:
其次,我建议添加以下apt upgrade
步骤:
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt update
sudo apt upgrade
sudo apt install python3.6
The upgrade step ensures that all your installed packages are upgraded to their latest version, and can often fix "errors while processing" other packages' installation.
升级步骤可确保所有已安装的软件包都升级到最新版本,并且通常可以修复“处理时出错”其他软件包的安装。
回答by Ocab19
That's a weird error, there might be something wrong with your dpkg. You can always try building python from source. This works in regular out-of-the-box Ubuntu, so it should run on Windows too.
这是一个奇怪的错误,您的 dpkg 可能有问题。您可以随时尝试从源代码构建 python。这适用于常规开箱即用的 Ubuntu,因此它也应该在 Windows 上运行。
sudo apt-get install zlib1g-dev
wget www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar -xf Python-3.6.0
cd Python-3.6.0
./configure --enable-optimizations
make
sudo make install
Save those commands to a file called python.sh, then run
将这些命令保存到名为 python.sh 的文件中,然后运行
chmod 755 python.sh
./python.sh
It can take a while, though, so be patient
不过,这可能需要一段时间,所以请耐心等待