关于mac上python版本问题

来源:2-3 使用官方推荐的pipenv创建虚拟环境(很好用哦~)

Jokky

2018-08-11

jokkydeMacBook-Pro:~ jokky$ python -v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /Applications/MAMP/Library/lib/python2.7/site.pyc matches /Applications/MAMP/Library/lib/python2.7/site.py
import site # precompiled from /Applications/MAMP/Library/lib/python2.7/site.pyc
# /Applications/MAMP/Library/lib/python2.7/os.pyc matches /Applications/MAMP/Library/lib/python2.7/os.py
import os # precompiled from /Applications/MAMP/Library/lib/python2.7/os.pyc
import errno # builtin
import posix # builtin
# /Applications/MAMP/Library/lib/python2.7/posixpath.pyc matches /Applications/MAMP/Library/lib/python2.7/posixpath.py
import posixpath # precompiled from /Applications/MAMP/Library/lib/python2.7/posixpath.pyc
# /Applications/MAMP/Library/lib/python2.7/stat.pyc matches /Applications/MAMP/Library/lib/python2.7/stat.py
import stat # precompiled from /Applications/MAMP/Library/lib/python2.7/stat.pyc
# /Applications/MAMP/Library/lib/python2.7/genericpath.pyc matches /Applications/MAMP/Library/lib/python2.7/genericpath.py
import genericpath # precompiled from /Applications/MAMP/Library/lib/python2.7/genericpath.pyc
# /Applications/MAMP/Library/lib/python2.7/warnings.pyc matches /Applications/MAMP/Library/lib/python2.7/warnings.py
import warnings # precompiled from /Applications/MAMP/Library/lib/python2.7/warnings.pyc
# /Applications/MAMP/Library/lib/python2.7/linecache.pyc matches /Applications/MAMP/Library/lib/python2.7/linecache.py
import linecache # precompiled from /Applications/MAMP/Library/lib/python2.7/linecache.pyc
# /Applications/MAMP/Library/lib/python2.7/types.pyc matches /Applications/MAMP/Library/lib/python2.7/types.py
import types # precompiled from /Applications/MAMP/Library/lib/python2.7/types.pyc
# /Applications/MAMP/Library/lib/python2.7/UserDict.pyc matches /Applications/MAMP/Library/lib/python2.7/UserDict.py
import UserDict # precompiled from /Applications/MAMP/Library/lib/python2.7/UserDict.pyc
# /Applications/MAMP/Library/lib/python2.7/_abcoll.pyc matches /Applications/MAMP/Library/lib/python2.7/_abcoll.py
import _abcoll # precompiled from /Applications/MAMP/Library/lib/python2.7/_abcoll.pyc
# /Applications/MAMP/Library/lib/python2.7/abc.pyc matches /Applications/MAMP/Library/lib/python2.7/abc.py
import abc # precompiled from /Applications/MAMP/Library/lib/python2.7/abc.pyc
# /Applications/MAMP/Library/lib/python2.7/_weakrefset.pyc matches /Applications/MAMP/Library/lib/python2.7/_weakrefset.py
import _weakrefset # precompiled from /Applications/MAMP/Library/lib/python2.7/_weakrefset.pyc
import _weakref # builtin
# /Applications/MAMP/Library/lib/python2.7/copy_reg.pyc matches /Applications/MAMP/Library/lib/python2.7/copy_reg.py
import copy_reg # precompiled from /Applications/MAMP/Library/lib/python2.7/copy_reg.pyc
# /Applications/MAMP/Library/lib/python2.7/traceback.pyc matches /Applications/MAMP/Library/lib/python2.7/traceback.py
import traceback # precompiled from /Applications/MAMP/Library/lib/python2.7/traceback.pyc
# /Applications/MAMP/Library/lib/python2.7/sysconfig.pyc matches /Applications/MAMP/Library/lib/python2.7/sysconfig.py
import sysconfig # precompiled from /Applications/MAMP/Library/lib/python2.7/sysconfig.pyc
# /Applications/MAMP/Library/lib/python2.7/re.pyc matches /Applications/MAMP/Library/lib/python2.7/re.py
import re # precompiled from /Applications/MAMP/Library/lib/python2.7/re.pyc
# /Applications/MAMP/Library/lib/python2.7/sre_compile.pyc matches /Applications/MAMP/Library/lib/python2.7/sre_compile.py
import sre_compile # precompiled from /Applications/MAMP/Library/lib/python2.7/sre_compile.pyc
import _sre # builtin
# /Applications/MAMP/Library/lib/python2.7/sre_parse.pyc matches /Applications/MAMP/Library/lib/python2.7/sre_parse.py
import sre_parse # precompiled from /Applications/MAMP/Library/lib/python2.7/sre_parse.pyc
# /Applications/MAMP/Library/lib/python2.7/sre_constants.pyc matches /Applications/MAMP/Library/lib/python2.7/sre_constants.py
import sre_constants # precompiled from /Applications/MAMP/Library/lib/python2.7/sre_constants.pyc
dlopen("/Applications/MAMP/Library/lib/python2.7/lib-dynload/_locale.so", 2);
import _locale # dynamically loaded from /Applications/MAMP/Library/lib/python2.7/lib-dynload/_locale.so
# /Applications/MAMP/Library/lib/python2.7/_sysconfigdata.pyc matches /Applications/MAMP/Library/lib/python2.7/_sysconfigdata.py
import _sysconfigdata # precompiled from /Applications/MAMP/Library/lib/python2.7/_sysconfigdata.pyc
# /Applications/MAMP/Library/lib/python2.7/_osx_support.pyc matches /Applications/MAMP/Library/lib/python2.7/_osx_support.py
import _osx_support # precompiled from /Applications/MAMP/Library/lib/python2.7/_osx_support.pyc
# zipimport: found 111 names in /Applications/MAMP/Library/lib/python2.7/site-packages/setuptools-18.7.1-py2.7.egg
# zipimport: found 8 names in /Applications/MAMP/Library/lib/python2.7/site-packages/python_memcached-1.57-py2.7.egg
import encodings # directory /Applications/MAMP/Library/lib/python2.7/encodings
# /Applications/MAMP/Library/lib/python2.7/encodings/__init__.pyc matches /Applications/MAMP/Library/lib/python2.7/encodings/__init__.py
import encodings # precompiled from /Applications/MAMP/Library/lib/python2.7/encodings/__init__.pyc
# /Applications/MAMP/Library/lib/python2.7/codecs.pyc matches /Applications/MAMP/Library/lib/python2.7/codecs.py
import codecs # precompiled from /Applications/MAMP/Library/lib/python2.7/codecs.pyc
import _codecs # builtin
# /Applications/MAMP/Library/lib/python2.7/encodings/aliases.pyc matches /Applications/MAMP/Library/lib/python2.7/encodings/aliases.py
import encodings.aliases # precompiled from /Applications/MAMP/Library/lib/python2.7/encodings/aliases.pyc
# /Applications/MAMP/Library/lib/python2.7/encodings/utf_8.pyc matches /Applications/MAMP/Library/lib/python2.7/encodings/utf_8.py
import encodings.utf_8 # precompiled from /Applications/MAMP/Library/lib/python2.7/encodings/utf_8.pyc
Python 2.7.13 (default, Nov 27 2017, 14:49:20)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
dlopen("/Applications/MAMP/Library/lib/python2.7/lib-dynload/readline.so", 2);
import readline # dynamically loaded from /Applications/MAMP/Library/lib/python2.7/lib-dynload/readline.so
>>>

我在命令行中直接输入  python -v就出现如下显示,不过我的确是在mac上安装了 python3.6的

这边为什么一直都是显示的python2.7呢

写回答

1回答

7七月

2018-08-11

python -V  大V。因为你默认的环境变量还是2.7啊,你装了多个版本,为什么你会认为一定是Python3.6呢。你可以用python3 来运行python3.6,也可以自己修改python 指向 python3.6

0
1
Jokky
非常感谢!
2018-08-11
共1条回复

Python Flask高级编程之从0到1开发《鱼书》精品项目

7月老师深入浅出剖析Flask核心机制,和你一起探讨Python高级编程

2735 学习 · 1267 问题

查看课程