Answers:
您可以自定义python3
别名。为此,您可以通过在.bashrc
文件末尾添加“ alias python3='python3.3'
” 来修改文件。这个shell脚本可以为您做:
#!/bin/bash
cd ~
# Create the ~/.bashrc file if it does not exist
if [ ! -f ./.bashrc ]; then
touch .bashrc
chmod 755 .bashrc
echo "#!/bin/bash" >> .bashrc
fi
# Append the customed alias
echo " " >> .bashrc
echo "alias python3='python3.3'" >> .bashrc
echo " " >> .bashrc
# Reload settings in the .bashrc script
source .bashrc
您可以通过设置适当的环境变量在同一系统上运行不同的python版本。这将使您可以在本地安装突触软件包管理器可能提供的更高版本的Python。例如,在文件(mysetup)中具有:
TK_LIBRARY=/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/site-packages/PIL:/usr/lib
TKPATH=/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/site-packages/PIL:/usr/lib
TCL_LIBRARY=/usr/lib
export TCL_LIBRARY TK_LIBRARY TKKPATH
export PYTHONPATH=/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-stdwin:/usr/lib/python2.7/lib-dynload:/usr/lib:.
并使用它们将它们放到您的环境中。mysetup