简体   繁体   English

使用比Linux服务器上安装的Python版本新的Python

[英]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.

相关问题 即使安装较新版本的Python旧版本的Cython - Python old version of Cython even when newer version installed 即使安装了新版本也使用旧版本的numpy - Using old version of numpy even with a newer version installed 什么是安装的Python版本 - What is the Python Version installed Pip 正在尝试使用与安装版本不同的 python 版本 - Pip is trying to use a different version of python than what is installed Python 安装错误“已安装较新版本的 Python 启动器” - Python install error "A newer version of the Python launcher is already installed" 我安装了 2 个版本的 python,但 cmake 使用的是旧版本。 如何强制 cmake 使用较新版本? - I have 2 versions of python installed, but cmake is using older version. How do I force cmake to use the newer version? 如何在安装较新版本和默认版本时打开早期版本的python? - How do I open an earlier version of python when the newer version is installed and the default? 安装较新版本后如何安装较旧版本的python - How to install older version of python when we have installed a newer version 强制 python 使用旧版本的模块(比我现在安装的版本) - Force python to use an older version of module (than what I have installed now) Python 3.8.6 说我安装了更新版本的 Python,但我没有 - Python 3.8.6 says I have a newer version of Python installed, but I don't
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM