[英]Using a newer version of Python than what is installed on Linux server
I have an account on a Linux server which currently has Python2.4 installed on it so by default running the command which python
returns /usr/bin/python
我在当前安装了Python2.4的Linux服务器上有一个帐户,因此默认情况下运行
which python
返回/usr/bin/python
I have installed Python2.7 in my account home directory @ /path/to/myaccount and have set and sourced the path in my .bash_profile file as 我已经在我的帐户主目录@ / path / to / myaccount中安装了Python2.7,并在.bash_profile文件中设置了该路径并将其来源
PYTHONPATH=/path/to/myaccount/bin/python
export PATH=$PYTHONPATH:$PATH
However I am still getting Python2.4 as my default Python. 但是我仍然将Python2.4作为默认Python。
PYTHONPATH
tells Python where to look for modules and packages ( .py
files etc) PYTHONPATH
告诉Python在哪里寻找模块和软件包( .py
文件等)
You need to make sure your shell is looking in the right place for the Python binary 您需要确保您的外壳在正确的位置查找Python二进制文件
export PATH=/path/to/myaccount/bin:$PATH
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.