在我的电脑上
~$ python -V Python 3.2.1
但是当我运行一些python程序时遇到了问题。我的猜测是(或者至少我想尝试一下)存在一些向后兼容性问题,并且我想使用
python2 2.7.2-2
它也安装在我的系统上,但我不知道如何使它成为(临时)默认python。python脚本以
#!/usr/bin/env python
而且我正在使用Arch Linux。
您可以使用virtualenv
# Use this to create your temporary python "install" # (Assuming that is the correct path to the python interpreter you want to use.) virtualenv -p /usr/bin/python2.7 --distribute temp-python # Type this command when you want to use your temporary python. # While you are using your temporary python you will also have access to a temporary pip, # which will keep all packages installed with it separate from your main python install. # A shorter version of this command would be ". temp-python/bin/activate" source temp-python/bin/activate # When you no longer wish to use you temporary python type deactivate
请享用!