[英]Install older Version of Python on Mac via virtualenv
I need to install a certain package, for which the developers suggest Python 3.5
, since they don't support 3.7
yet.我需要安装某个包,开发人员建议使用Python 3.5
,因为他们还不支持3.7
。 I am running Mac OS Mojave 10.14.2
and my Python version is 3.7.1
.我正在运行Mac OS Mojave 10.14.2
并且我的 Python 版本是3.7.1
。
I have come across methods to switch between Python 2.x
and 3.x
using Virtualenv
, such as below:我遇到过使用Virtualenv
在Python 2.x
和3.x
之间切换的方法,如下所示:
virtualenv -p python2 myenv
virtualenv -p python3 myenv
However, is it even possible to have a specific version of Python, that too one older than I have already installed on my system?但是,甚至可能有一个特定版本的 Python,比我已经安装在我的系统上的版本还要老吗?
Yes, it is possible to have multiple versions of Python installed on OSX.是的,可以在 OSX 上安装多个版本的 Python。 Each one installs to a different path.每个安装到不同的路径。 You can't have multiple 'python3' executables in your path -- but if you use the absolute path then it'll work out fine.你的路径中不能有多个“python3”可执行文件——但如果你使用绝对路径,那么它会很好地工作。
You can go download the OSX version of Python 3.5 (which will install itself as python3.5 somewhere), and then create a virtualenv via您可以下载 OSX 版本的 Python 3.5(它将在某处安装为 python3.5),然后通过创建一个 virtualenv
virtualenv -p /absolute/path/to/python3.5 myenv
you can use您可以使用
python -m virtualenv <env_name> --python=<full-path-to-python-exectuable-file-and-exe-file>
here <full-path-to-python-exectuable-file-and-exe-file>
add python3.5 which you have downloaded这里<full-path-to-python-exectuable-file-and-exe-file>
添加你下载的 python3.5
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.