我从未使用过 virtualenv,我正在使用 Ubuntu 15.04(通过 ssh 远程),我被告知我无法对 Python 系统进行任何更改。 Ubuntu 15.04 附带 Pythons 2.7 和 3.4.3,但我希望在我的 virtualenv 中使用 Python 3.5。我试过 virtualenv -p python3.5 my_env 它给出了 The executable python3.5 (from --python=python3.5) does not exist,我接受了这意味着它在提示系统没有 Python 3.5。那么,如果系统还没有 Python 3.5,是不是不可能用 Python 3.5 创建一个 virtualenv?
请您参考如下方法:
你可以只安装最新版本的python。您还可以在用户的主目录中下载并安装不同的版本。
如果您计划手动安装多个版本。这是来自官方 python README 文件。
Installing multiple versions
On Unix and Mac systems if you intend to install multiple versions of Python using the same installation prefix (--prefix argument to the configure script) you must take care that your primary python executable is not overwritten by the installation of a different version. All files and directories installed using "make altinstall" contain the major and minor version and can thus live side-by-side. "make install" also creates ${prefix}/bin/python3 which refers to ${prefix}/bin/pythonX.Y. If you intend to install multiple versions using the same prefix you must decide which version (if any) is your "primary" version. Install that version using "make install". Install all other versions using "make altinstall".
For example, if you want to install Python 2.5, 2.6 and 3.0 with 2.6 being the primary version, you would execute "make install" in your 2.6 build directory and "make altinstall" in the others.
完成后,您可以使用您选择的 python 版本继续使用 python 的虚拟环境。
