为什么虚拟环境中的IDLE仍然使用系统的?
我在本地创建了一个Python安装,路径是 ~/localpython/python276。然后我创建了一个名为 py276 的虚拟环境,并把 IDLE 链接到了 ~/localpython/python276/bin/idle
。我也激活了这个 py276 环境。
$ which python
/home/xxx/virtualenvs/py276/bin/python
$ python
Python 2.7.6
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
$ bin/idle
Python 2.7.6
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
看起来一切都没问题。但是,如果我直接用 idle
这个命令,它还是会使用系统自带的版本,这就很奇怪,因为我用 which idle
查询时返回的结果是正确的。
$ which idle
/home/xxx/virtualenvs/py276/bin/idle
$ idle
Python 2.7.3
[GCC 4.6.3] on linux2
Type "copyright", "credits" or "license()" for more information.
有没有人知道为什么会这样?
1 个回答
0
这可能是因为在命令行中单独输入 idle
实际上是指向安装的 2.7.3 版本的一个符号链接。你需要更改这个符号链接,或者在命令中更明确一些。