首页 > 解决方案 > 在 Cloudready/Chromium/Chrome OS 上安装 Python 3,无需安装 Linux 容器/环境

问题描述

最近我在 VirtualBox 6.1 上安装了 Neverware 的 Chromium OS 版本,称为 Cloudready,为 Chromebook 开发 Python 应用程序。此版本的 Chromium OS 是 48.0.2564.116 开发人员版本(由于图形不兼容,无法安装较新的版本)。由于我没有 Google 帐户,因此我以访客用户身份登录 Chromium OS(不知何故,我作为访客拥有管理权限,这对我的开发目的有好处)。

我发现预装了 Python 2.7.3。我尝试安装 Python 3.6,为此,我尝试找到预装的包管理器,最终我找到了。预安装的包管理器(portage)不安装任何东西,因为它给出了类似于这个的错误:

chronos@localhost / $ sudo emerge dev-lang/python:3.6
!!! PORTAGE_BINHOST unset, but use is requested.
!!! Problem with sandbox library. Disabling...

Calculating dependencies... done!

WARNING: A requested package will not be merged because it is listed in
package.provided:

  dev-lang/python:3.6 pulled in by 'args'

>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.
chronos@localhost / $

我尝试从此处get-pip.py提供的脚本为 Python 2 安装 Python PIP ,并且成功了。因为我想为我的 Chromebook 程序创建图形界面,所以我想安装该模块,并且因为我不希望我的程序的用户必须使用终端来执行我的 Python 程序并安装 Python 模块,所以我想要安装 PyInstaller。我想通过 PIP 安装 PyInstaller,但是 PIP 对于任何尝试的模块安装都会抛出以下错误:tkinter

/usr/local/lib64/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.py:387: SNIMissingWarning: An HTTPS requ
est has been made, but the SNI (Server Name Indication) extension to TLS is not available on this platform. Thi
s may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can up
grade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/l
atest/advanced-usage.html#ssl.warnings
  SNIMissingWarning,
/usr/local/lib64/python2.7/site-packages/pip_vendor/urllib3/util/ssl_.py:142: InsecurePlatformWarning: A true
SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause cert
ain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information,
see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning,

在尝试安装 PyInstaller 时,PIP 实际上设法收集了pyinstaller-4.0.tar.gz包,但安装失败,因为 PyInstaller 安装程序引发异常/错误BackendUnavailable,然后 PIPInsecurePlatformWarning再次引发错误。正如@BryanOakley 所指出的,我无法从 PIP 安装 Tkinter,这是我在使用 Chromium OS 时忘记的(例如,在 Ubuntu 上安装 Tkinter 的命令是sudo apt-get install python3-tk),这让事情变得更加棘手。

从提出的错误来看,我似乎必须安装更新版本的 Python(我已经尝试过,但无济于事)。我尝试通过安装 Anaconda 3 和 Miniconda 3 来安装 Python 3,但两者都提供了相同的错误,我什至查看了 Stack Overflow,人们投票作为答案的内容仍然对我不起作用。以下命令...

$ mkdir ~/Downloads/TMP
$ TMPDIR=~/Downloads/TMP sudo bash ~/Downloads/Miniconda3-latest-Linux-x86_64.sh -p /usr/local/miniconda3

...最终导致此输出:

/usr/local/miniconda3/conda.exe: error while loading shared libraries: libz.so.1: failed to segment from sh
ared object: Operation not permitted
/usr/local/miniconda3/conda.exe: error while loading shared libraries: libz.so.1: failed to segment from sh
ared object: Operation not permitted

到目前为止没有任何效果。如何在 Chromium OS 版本 48 上成功安装带有 Tkinter 和 PyInstaller 的 Python 3.6 而不安装 Linux 容器/环境(例如安装官方 Linux(Beta)或 Crouton 的选项)或从 Google Play 商店安装任何东西?

标签: pythonpython-3.xtkinterpyinstallergoogle-chrome-os

解决方案


可能有两种可能:

1)。python3.6 已经安装好了。

WARNING: A requested package will not be merged because it is listed in
package.provided:

要检查尝试:

which python3 或者干脆尝试运行 python3

2)。卸载 python2 以便甚至不需要合并也可以帮助您。


推荐阅读