简体   繁体   English

如何安装 python 3.6.10 和预装的 3.8.2

[英]How to install python 3.6.10 alongside presinstalled 3.8.2

I recently installed Pop,_OS on my laptop for development purposes.我最近在我的笔记本电脑上安装了 Pop,_OS 用于开发目的。 but i found out the version of python installed is 3.8,2.但我发现安装的 python 的版本是 3.8,2。 which unfortunately doesnt support versions of tensorflow below 2.0.不幸的是,它不支持低于 2.0 的 tensorflow 版本。 I need to use tensorflow 1.14 for my work and this is not possible with python 3.8.我的工作需要使用 tensorflow 1.14,而这在 python 3.8 中是不可能的。

Im willing to use python 3.6 in a virtual environment or have it alongside 3.8 in my laptop.我愿意在虚拟环境中使用 python 3.6,或者在我的笔记本电脑中使用 3.8。 Im rather new to linux so please excuse any mistakes.我对 linux 相当陌生,所以请原谅任何错误。 Thanks in advance!提前致谢!

Instead of virtual environment I would suggest using pyenv .我建议使用pyenv而不是虚拟环境。 It's very convenient and easier to work with than virtual environment, it also seems to fit your needs perfectly.它比虚拟环境更方便和更容易使用,它似乎也完美地满足了您的需求。 It will even allow you to have different version of python depending on the current working directory (the interpreter is selected automatically when you change directory so you never have to worry again about that).它甚至允许您根据当前工作目录拥有不同版本的 python(当您更改目录时会自动选择解释器,因此您不必再担心)。

The installation of pyenv is described here , once you have everything set up, you'll just need to run:这里描述了 pyenv 的安装,一旦你完成了所有设置,你只需要运行:

$ pyenv install 3.6.10
$ cd directory_where_you_need_3.6
$ pyenv local 3.6.10

Alternatively, if you wish to use 3.6.10 everywhere you can also do:或者,如果您希望在任何地方使用3.6.10 ,您也可以这样做:

$ pyenv global 3.6.10

Which will make 3.6.10 your default interpreter independently of your current working directory.这将使3.6.10成为独立于当前工作目录的默认解释器。

Try to install anaconda ( https://docs.anaconda.com/anaconda/install/linux/ ).尝试安装 anaconda ( https://docs.anaconda.com/anaconda/install/linux/ )。 It lets you create virtual environments with specified python version using conda create command with python option like this:它允许您使用带有 python 选项的 conda create 命令创建具有指定 python 版本的虚拟环境,如下所示:

conda create -n yourenvname python=x.x

easiest way is to create a virtual env with a specific python version最简单的方法是创建一个具有特定 python 版本的虚拟环境

virtualenv envname --python=python3.6

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

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