V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
yazoox
V2EX  ›  Python

为什么我输入 python3 显示却是 C:\python32\lib... 的错误?

  •  
  •   yazoox · Apr 4, 2018 · 5184 views
    This topic created in 2957 days ago, the information mentioned may be changed or developed.

    在命令行里面输入,python3,结果显示:

    Fatal Python error: Py_Initialize: unable to load the file system codec
      File "C:\Python27\lib\encodings\__init__.py", line 123
        raise CodecRegistryError,\
                                ^
    SyntaxError: invalid syntax
    
    Current thread 0x000018e4 (most recent call first):
    

    然后再输入 where python3,显示:

    C:\Python36\python3.exe
    

    注:都已经添加到 Path 里面去了,系统是 win10

    C:\python27
    C:\python27\scripts
    C:\python36
    C:\python36\scripts
    
    Supplement 1  ·  Apr 5, 2018
    不好意思啊,标题写错了
    错误提示里面,路径是 Python27,不是 Python32
    不能修改原贴了。
    11 replies    2018-04-05 20:14:56 +08:00
    uestc630
        1
    uestc630  
       Apr 4, 2018 via Android
    py -3
    ysc3839
        2
    ysc3839  
       Apr 4, 2018 via Android
    命令行执行 set 看看?
    kokutou
        3
    kokutou  
       Apr 4, 2018 via Android
    把你加的环境变量都删掉。。。
    oIMOo
        4
    oIMOo  
       Apr 4, 2018
    python3 你添加 python2 的东西, emmm...
    geelaw
        5
    geelaw  
       Apr 4, 2018
    我想了半天为什么是 32,大概是 3 和 2 的杂糅吧。

    你可以把 Python 3.6 在 PATH 里面放在更前面,这样 Python 3.6 就可以用了,理论上。
    msg7086
        6
    msg7086  
       Apr 4, 2018
    标题写 C:\python32
    内容写 C:\Python27
    我已经看懵了。
    yazoox
        7
    yazoox  
    OP
       Apr 5, 2018 via Android
    @kokutou 为啥要删除环境变量啊?
    yazoox
        8
    yazoox  
    OP
       Apr 5, 2018 via Android
    @msg7086 不好意思,标题写错了。
    我在附言里更新了
    yhx5768
        9
    yhx5768  
       Apr 5, 2018 via Android
    装过 python3 后基本用 py -2 py -3 进行切换了
    yazoox
        10
    yazoox  
    OP
       Apr 5, 2018 via Android
    @yhx5768 兄弟,怎么同时并存 2 和 3 啊
    我就是看百度来的方法设置的,分别放在 C 盘下的两个目录中间,然后添加到 path,怎么不行呢?
    yhx5768
        11
    yhx5768  
       Apr 5, 2018
    @yazoox #10 正常安装 python2.7 python3.6 后可以在 cmd 中直接使用 py 命令进行调用
    py -2 调用 python2.7
    py -3 调用 python3.6
    py 这个应该是包含在 3.6 中的.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3106 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 03:35 · PVG 11:35 · LAX 20:35 · JFK 23:35
    ♥ Do have faith in what you're doing.