这是我在 Mac 中的控制台的摘录,你可以看到控制台上的 Python 是 2.7.15,但在环境中它变成了 2.7.10,这是一个旧版本......关于为什么以及如何的任何帮助欢迎修复它!
dhcp-18-57:Wakeup6 **jbs$ python**
**Python 2.7.15** (default, May 1 2018, 16:44:14)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
dhcp-18-57:Wakeup6 jbs$ virtualenv env
New python executable in /Users/jbs/PycharmProjects/Wakeup6/env/bin/python
Installing setuptools, pip, wheel...done.
dhcp-18-57:Wakeup6 jbs$ source env/bin/activate
(env) dhcp-18-57:Wakeup6 **jbs$ python**
**Python 2.7.10** (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
请您参考如下方法:
如果您使用 Anaconda 安装了 python,然后为 python 2.7.15 设置一个新的虚拟环境,然后按照 Anaconda 文档中的说明激活这个虚拟环境,您就可以开始了。
如果您没有使用 Anaconda,只需按照在 Unix 机器上设置虚拟环境的说明进行操作即可。然后激活该环境并开始工作。
您的计算机上可以有多个版本。虚拟环境允许您运行您想要的版本。我有 python 2.7.13 和 python 3.6 的虚拟环境。
如果这不起作用,请告诉我。我会尽力提供帮助。
