簡體   English   中英

我安裝了python 2.7和3.5,但python 3.5不能正常工作

[英]I installed both python 2.7 and 3.5, but python 3.5 does not work well

在終端中,我可以成功運行py -2 盡管如此,

C:\Users\user>py -3
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 0x00004570 (most recent call first):

刪除“PYTHONHOME”環境變量。 (這在安裝python27 x86和python36 x64時解決了我的問題)

您可以嘗試設置python路徑。

C:\Users\user>set PATH=C:\Program Files\Python 3.5;%PATH%
C:\Users\user>set PYTHONPATH=%PYTHONPATH%;C:\python_lib_path
C:\Users\user>python

我曾經有過同樣的問題。 我發現我的python 2.7是x86而我的python 3.5是x64 ,所以我刪除了python 2和3,然后重新安裝python 2.7和3.5作為x64 ,然后它工作。

我的安裝應用程序如圖所示

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM