无法使 Python 3.7 在 Ubuntu 18.04 中工作
Cannot make Python 3.7 work in Ubuntu 18.04
我正在 Python 和 Ubuntu 18.04 中学习 Django,其中安装了 Python 3.6.7 和 3.7.2。每当给出 Pyhon3 命令时,它都会显示 3.7 的提示,但是当我使用 pipenv 为项目创建虚拟环境时,它仍在使用 /usr/bin/python3(Python3.6.7) 而不是 Python3.7.2。甚至 Python3.7.2 也已使用以下命令配置为最高优先级 2 的默认值:
sudo update-alternatives --install /usr/binpython3 python3 /usr/bin /python3.6 1
sudo update-alternatives --install /usr/binpython3 python3 /usr/bin /python3.7 2
sudo update-alternatives --configure python3
并且上面的命令通过“*”符号显示 Python3.7 作为默认值,但 pipenv 仍然使用 Python3.6.7。我希望 pipenv 仅使用 Python3.7 而不是 3.6。不知道该怎么办。请帮忙。
要找出 python 系统所在的位置 运行 你可以
which python
此外,问题可能是 pipenv 特定的而不是系统的。
Specify your target Python version in your Pipfile’s [requires] section. Ideally, you should only have one target Python version, as this is a deployment tool.
General Recommendations & Version Control¶
这更有可能是您要查找的内容
一些不需要的建议
我的第一个建议是放弃 python 3.6 并坚持使用 python 3.7。
我的第二个建议是停止担心 python 版本。
当您学习时,您使用的是哪个版本并不重要(我指的是次要版本号 - 3.5/3.6/3.7 或任何高于 3.3 的版本 - 稍后您将了解版本号之间的区别)。
Here you can read the release notes for python 3.7
刚开始学习,重点应该放在了解基础知识上。在 python 3.6 和 python 3.7 之间切换时您会分心。而且会花更长的时间。
但是,您在这里和那里了解了一些小细节,这在某种程度上是好的。你需要问问自己,你的首要任务是什么。
终于找到了我的 problem.Its "pyenv" 的完美解决方案。在 ubuntu.Sorry 中安装了 pyenv,windows 没有安装 pyenv。它仅适用于 Mac 和 Linux。我可以安装任意多个我喜欢的 Linux 版本,并在每个项目基础上使用其中的任何一个。
我所有的困惑和问题都消失了 now.Very 对 "pyenv" 解决方案感到满意。
我正在 Python 和 Ubuntu 18.04 中学习 Django,其中安装了 Python 3.6.7 和 3.7.2。每当给出 Pyhon3 命令时,它都会显示 3.7 的提示,但是当我使用 pipenv 为项目创建虚拟环境时,它仍在使用 /usr/bin/python3(Python3.6.7) 而不是 Python3.7.2。甚至 Python3.7.2 也已使用以下命令配置为最高优先级 2 的默认值:
sudo update-alternatives --install /usr/binpython3 python3 /usr/bin /python3.6 1
sudo update-alternatives --install /usr/binpython3 python3 /usr/bin /python3.7 2
sudo update-alternatives --configure python3
并且上面的命令通过“*”符号显示 Python3.7 作为默认值,但 pipenv 仍然使用 Python3.6.7。我希望 pipenv 仅使用 Python3.7 而不是 3.6。不知道该怎么办。请帮忙。
要找出 python 系统所在的位置 运行 你可以
which python
此外,问题可能是 pipenv 特定的而不是系统的。
Specify your target Python version in your Pipfile’s [requires] section. Ideally, you should only have one target Python version, as this is a deployment tool. General Recommendations & Version Control¶
这更有可能是您要查找的内容
一些不需要的建议
我的第一个建议是放弃 python 3.6 并坚持使用 python 3.7。 我的第二个建议是停止担心 python 版本。 当您学习时,您使用的是哪个版本并不重要(我指的是次要版本号 - 3.5/3.6/3.7 或任何高于 3.3 的版本 - 稍后您将了解版本号之间的区别)。 Here you can read the release notes for python 3.7
刚开始学习,重点应该放在了解基础知识上。在 python 3.6 和 python 3.7 之间切换时您会分心。而且会花更长的时间。
但是,您在这里和那里了解了一些小细节,这在某种程度上是好的。你需要问问自己,你的首要任务是什么。
终于找到了我的 problem.Its "pyenv" 的完美解决方案。在 ubuntu.Sorry 中安装了 pyenv,windows 没有安装 pyenv。它仅适用于 Mac 和 Linux。我可以安装任意多个我喜欢的 Linux 版本,并在每个项目基础上使用其中的任何一个。
我所有的困惑和问题都消失了 now.Very 对 "pyenv" 解决方案感到满意。