Anaconda3上同时安装python3.8和python2.7时Python2无法工作
我安装了Anaconda并使用Python3.8.8作为基础环境,现在我创建一个名为py27
的新环境来安装python2.7,但它不起作用。
以下是详细信息
(base) C:\Windows\System32>conda env list
# conda environments:
#
base * C:\ProgramData\Anaconda3
pix2vox C:\Users\10531\.conda\envs\pix2vox
py27 C:\Users\10531\.conda\envs\py27
(base) C:\Windows\System32>python
Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
(base) C:\Windows\System32>conda activate py27
(py27) C:\Windows\System32>python
File "C:\ProgramData\Anaconda3\lib\site.py", line 178
file=sys.stderr)
^
SyntaxError: invalid syntax
(py27) C:\Windows\System32>
我的环境变量 PATH 包含
C:\ProgramData\Anaconda3;
C:\ProgramData\Anaconda3\Scripts;
C:\ProgramData\Anaconda3\Library\mingw-w64\bin;
C:\ProgramData\Anaconda3\Library\usr\bin;
C:\ProgramData\Anaconda3\Library\bin;
我想同时使用 python3.8 和 python2.7,请帮助我,谢谢!
I installed Anaconda and used Python3.8.8 as the base environment, now I create a new environment named py27
to install python2.7, but it doesn't work.
Here are the details
(base) C:\Windows\System32>conda env list
# conda environments:
#
base * C:\ProgramData\Anaconda3
pix2vox C:\Users\10531\.conda\envs\pix2vox
py27 C:\Users\10531\.conda\envs\py27
(base) C:\Windows\System32>python
Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
(base) C:\Windows\System32>conda activate py27
(py27) C:\Windows\System32>python
File "C:\ProgramData\Anaconda3\lib\site.py", line 178
file=sys.stderr)
^
SyntaxError: invalid syntax
(py27) C:\Windows\System32>
My environment variable PATH contains
C:\ProgramData\Anaconda3;
C:\ProgramData\Anaconda3\Scripts;
C:\ProgramData\Anaconda3\Library\mingw-w64\bin;
C:\ProgramData\Anaconda3\Library\usr\bin;
C:\ProgramData\Anaconda3\Library\bin;
I want to use both python3.8 and python2.7 simultaneously, please help me, thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我修好了。
删除
PYTHONHOME
环境变量,我之前设置为C:\ProgramData\Anaconda3;
。删除
,我不知道是否有效,但我做到了。
在 PATH 中
I fixed it.
Delete the
PYTHONHOME
environment variable, I set it asC:\ProgramData\Anaconda3;
before.Delete
in Path, I didn't know if it works, but I did it.
in PATH.