How to upgrade the version of Python used by Apache?

On a Red hat box, I upgraded Python from 2.3 to 2.6.4 and changed the symlink to python so when I type in python the 2.6.4 interpreter comes up.

However my .py file works from the command-line, but not in the browser. It seemed like a sys.path issue so I opened the file in a browser and printed out sys.path.

Surprisingly, my sys.path is different when called from a browser than when called from a command-line. Because the paths are all referring to 2.3, I believe Apache is picking up Python 2.3 rather than the new 2.6.4 version I installed.

How do I make Apache use Python 2.6.4?


Asked by: Lenny174 | Posted: 06-12-2021






Answer 1

If you're using mod_python or mod_wsgi, you should reinstall them as they've probably been built to the python version you had when they were first installed on the system (which in your case appears to be Python 2.3).

Answered by: Nicole685 | Posted: 07-01-2022



Answer 2

Apache isn't calling python directly, so the path is irrelevant. You will probably want to build yourself a new mod_wsgi to link against python 2.6.4.

Answered by: Miller587 | Posted: 07-01-2022



Answer 3

On RH box Apache probably runs as root user. Login as root and see which version of python root sees.

HIH

..richie

Answered by: Joyce286 | Posted: 07-01-2022



Similar questions

upgrade python version using pip

So I have python 2.7.3 installed on Windows 7 64 bit and I want to do an incremental upgrade to version 2.7.5. I have pip installed and it works fine; I just installed Django using it. I ran into this command: pip install --upgrade 'python>=2.7,<2.7.99' Now it forces pip to download the latest version that is not Python 3 which is what I want. 2.7.5 starts downloading and I get the following error: ...


python - How to upgrade scrapy to latest version

Q:how to upgrade scrapy? I have run the cmd as administrator,use the command "pip install --upgrade scrapy" and get result as 'Access is denied' I am using windows 7. Is there any way to upgrade scrapy. Thanks a lot for any suggestion!


python - Can't upgrade my version of pip. Something is wrong with my setup

I was trying to install something using pip, and I keep getting this UserWarning error (see below). I tried to upgrade pip and you can see the error below. I haven't used python on my system in a while and it seems to be broken. What could it be? pip install -U pip /usr/local/bin/pip:5: UserWarning: Module _markerlib was already imported from /Library/Python/2.7/site-packages/distribute-0.6...


python - Cannot upgrade pip from 1.5.4 to latest version

I am running ubuntu gnome 14.04 and have pip 1.5.4 installed for both python 2.7.6 and python 3.4.3. I want to upgrade pip to the latest version but when I run the command pip install -U pip I get the following error . Downloading/unpacking pip from https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bce...


python - failed to upgrade a pip version from branch

My staging setup uses ingenious as a pip my upgrade tool is sudo pip3.5 install git+https://github.com/my_fork/INGInious.git@my_branch --upgrade --no-cache-dir I've noticed that some files get upgraded and some don't drwxr-xr-x 3 root root 155 Jul 10 19:14 agent drwxr-xr-x 3 root root 59 Jul...


How to upgrade Python 2.x to latest 2.x version on MacOS

I have MacOS Sierra (10.12.6) and had Python 2.7.13 until I did brew upgrade and now it is showing 2.7.10 What is the best proven/safest way to upgrade to latest python 2.x (at this moment 2.7.14)?


python - How to upgrade Django to 2.0 version

This question already has an answer here:


How to upgrade python version on Ubuntu

I'm using Ubuntu 14.0.4. In my system I have installed Anaconda with python 2.7.14. Now I want to upgrade my python version & would like to use Python 3.6.3. So I followed the steps mentioned in below link Update python on linux 2.7 to 3.5 But after doing this my python --versi...


linux - How to upgrade Python version to 3.7?

Closed. This question does not meet Stack Overflow guid...


How can I upgrade Numpy in just one version of Python?

I am trying to get OpenCV working, but the issue with this is that my Python27 Numpp version is too old. Every time I write "install --upgrade numpy", I am told that Numpy is already up to date in C:Python37. How can I update Numpy in C:Python27 rather than 37? Any help would be much appreciated.


python - Upgrade Rpy2 version

I have previously installed rpy2 on my PC using the appropriate wheels from here. However, now I need to upgrade to the latest version of rpy2. I did the following: pip install rpy2 --upgrade But this did not work out, and gave me the following error: ERROR: Command errored...


python - Best method to upgrade atoti version?

I was trying to import atoti to my jupyterlab as import atoti as tt I encountered the below problem. Exception Traceback (most recent call last) <ipython-input-4-385abead9553> in <module> ----> 1 import atoti as tt ~\anaconda3\lib\site-packages\atoti\__init__.py in <module> 29 __edition__ = str(_EDITION) 30 ...


python - How to upgrade Plotly to latest version?

a few months ago I downloaded plotly using this (book from 2018): python -m pip install --user plotly but basically I dont even know which version is it. How can I check it and upgreat to latest version? I have windows on my PC. On the plotly webside I found instructions how to install latest version: pip install plotly==4.14.3 or conda install ...


python - Upgrade ONNX model from version 9 to 11

I'm working with an ONNX model that I need to quantize in order to reduce its size, for that I'm following the instructions on the official documentation: import onnx from onnxruntime.quantization import quantize_dynamic, QuantType model_fp32 = 'path/to/the/model.onnx' model_quant = 'path/to/the/model.quant.onn...


python - Upgrade ONNX model IR version from 3 to 4

I am working on an onnx model with IR of 3. However, I require an onnx model of IR 4. I am not able to find a script on how to do so. But, I found a script on how to change the opset version which is not what I want.


python - How to upgrade version of pyenv on Ubuntu

I wanted to install python 3.10 but that version is not available on pyenv version list. checked by pyenv install --list. People suggested to upgrade pyenv that but I do not see help related to updating pyenv.


python - Upgrade pip to latest version

In one environment (Ubuntu 20.04.4 LTS), I get this: » pip --version pip 21.3.1 from /xxx/.venv/lib/python3.6/site-packages/pip (python 3.6) » pip install --upgrade pip Requirement already satisfied: pip in ./.venv/lib/python3.6/site-packages (21.3.1) In another environment (docker container running CentOS Linux release 7.9.2009 (Core)), I get this: ...


python - upgrade from pandas 1.1.5 to latest version

simply not able to upgrade Pandas, tried below python --version Python 3.6.8 pip3 install --upgrade pandas Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: pandas in ./.local/lib/python3.6/site-packages (1.1.5) Requirement already satisfied: pytz>=2017.2 in ./.local/lib/python3.6/site-packages (from pandas) (2022.1) Requirement already ...


How to upgrade Python Pandas version?

I am using Python in Jupyter Notebook. My Pandas version is pandas: 0.23.4 in which I cannot use Explode or other advanced functions. I am trying to upgrade it using the codes like: !pip install -- upgrade pandas But keep receiving error messages like: Could not fetch URL


Upgrade version of python and pandas on Google Colab

I need to use python 3.9.14 and pandas 1.4.2 on Google Colab because of the .npz files I need to work with. I have successfully installed both using bash commands on the notebook, but it is not effective on the actual version I can use on the notebook itself. Here is some code and output to make it clearer. Python: bash command !python --version Python 3.9.14 noteb...


upgrade - How to make newest version of Python the default or first in path

I have installed a new version of Python, so I want to make sure when Python is invoked that version is first in my path. So, now on my 'C' drive I have "Python27" and "Python32" (old and new version, respectively). When I type "python" in the command line I get "Python 2.7". Using control panel I have changed the "path" and "pythonpath" user variables (from 'C:\Python27' to 'C:\Python32') and to be sure I have re...


upgrade python version using pip

So I have python 2.7.3 installed on Windows 7 64 bit and I want to do an incremental upgrade to version 2.7.5. I have pip installed and it works fine; I just installed Django using it. I ran into this command: pip install --upgrade 'python>=2.7,<2.7.99' Now it forces pip to download the latest version that is not Python 3 which is what I want. 2.7.5 starts downloading and I get the following error: ...


python - How to upgrade scrapy to latest version

Q:how to upgrade scrapy? I have run the cmd as administrator,use the command "pip install --upgrade scrapy" and get result as 'Access is denied' I am using windows 7. Is there any way to upgrade scrapy. Thanks a lot for any suggestion!


python - Can't upgrade my version of pip. Something is wrong with my setup

I was trying to install something using pip, and I keep getting this UserWarning error (see below). I tried to upgrade pip and you can see the error below. I haven't used python on my system in a while and it seems to be broken. What could it be? pip install -U pip /usr/local/bin/pip:5: UserWarning: Module _markerlib was already imported from /Library/Python/2.7/site-packages/distribute-0.6...


python - Cannot upgrade pip from 1.5.4 to latest version

I am running ubuntu gnome 14.04 and have pip 1.5.4 installed for both python 2.7.6 and python 3.4.3. I want to upgrade pip to the latest version but when I run the command pip install -U pip I get the following error . Downloading/unpacking pip from https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bce...


python - failed to upgrade a pip version from branch

My staging setup uses ingenious as a pip my upgrade tool is sudo pip3.5 install git+https://github.com/my_fork/INGInious.git@my_branch --upgrade --no-cache-dir I've noticed that some files get upgraded and some don't drwxr-xr-x 3 root root 155 Jul 10 19:14 agent drwxr-xr-x 3 root root 59 Jul...


Can I upgrade Python version upgrade from 2.7.12 to 2.7.14 on my windows system

Currently I am using python 2.7.12 on my windows system. I want to upgrade my python version from 2.7.12 to 2.7.14. Do I need to run the 2.7.14 msi and during installation I have to provide the same path where 2.7.12 is installed (In my system , the installation directory is C:\Python27 ?


How to upgrade Python 2.x to latest 2.x version on MacOS

I have MacOS Sierra (10.12.6) and had Python 2.7.13 until I did brew upgrade and now it is showing 2.7.10 What is the best proven/safest way to upgrade to latest python 2.x (at this moment 2.7.14)?


python - How to upgrade Django to 2.0 version

This question already has an answer here:


Upgrade Python version while running a Python program

I would like to upgrade my Python version from 2.6.6 to the newest version of 3.6.5 on a server. However, there is a program that has been running for multiple days and will be running for a week or more. Will my program continue to run until it finishes if I upgrade my Python version? P.S.: I ran my Python program with the screen command so I wouldn't have to stop it to be able to upgrade my Python version...


How do I upgrade python 2.5.2 to python 2.6rc2 on ubuntu linux 8.04?

I'd like to how to upgrade the default python installation(2.5.2) supplied with ubuntu 8.04 to python 2.6rc2. I'd like to make 2.6 the default python version on the system and migrate all the other useful installed python libraries installed on 2.5.2 to python 2.6rc2. Please let me know how I can achieve this. Thanks Dirk


macos - Upgrade Python to 2.6 on Mac

I'd like to upgrade the default python installation (2.5.1) supplied with OS X Leopard to the latest version. Please let me know how I can achieve this. Thanks


macos - Trying to upgrade Python to 3.0 on Mac OS 10.5.8

I'm having some problems upgrading Python on my Mac. For my first attempt, I downloaded and installed the 2.6.4 dmg MacPython installer from http://python.org/download/mac/. This did install 2.6.4, and when I ran 'python' from the terminal it says that version. However, I also had a test script where I am doing: import os, json ...


build - How can I upgrade the sqlite3 package in Python 2.6?

I was using Python 2.6.5 to build my application, which came with sqlite3 3.5.9. Apparently though, as I found out in another question of mine, foreign key support wasn't introduced in sqlite3 until version 3.6.19. However, Python 2.7 comes with sqlite3 3.6.21, so this work -- I decided I wanted to use foreign keys in my application, so I tried upgrading to python 2.7. I'm using twisted, and I couldn't for the life...


Upgrade python to 2.7 and Django to 1.4, but it tells me No module named *

I have just upgraded my python to 2.7 on my Ubuntu server, and reinstalled the Django to 1.4. I use python flup to run the Django application as fastcgi, but when I try to restart the application, it keeps telling me No module named * e.g. File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) ... File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", l...


upgrade - How to make newest version of Python the default or first in path

I have installed a new version of Python, so I want to make sure when Python is invoked that version is first in my path. So, now on my 'C' drive I have "Python27" and "Python32" (old and new version, respectively). When I type "python" in the command line I get "Python 2.7". Using control panel I have changed the "path" and "pythonpath" user variables (from 'C:\Python27' to 'C:\Python32') and to be sure I have re...


macos - Python pip broken after OS X 10.8 upgrade

Made the upgrade to Mac OS X 10.8 (Mountain Lion) and get now the following error when trying to call $ pip: Traceback (most recent call last): File "/usr/local/bin/pip", line 5, in <module> from pkg_resources import load_entry_point File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module> working_set.requ...


upgrade python from 2.4 to 2.6 in plone

I am trying to upgrade my plone version from 3.3.5 to 4.0. For this I went to this site: updating plone. But I got stuck in the first point. In plone 3, I have python version of 2.4. But for plone 4.x I will need python 2.6. How do I upgrade my python version? In my buildout.cfg I have:


python - NumPy won't upgrade from 1.5.1 to 1.6.2 on OS X 10.7

I am attempting to update/upgrade my NumPy, but am failing. I think I might have multiple versions of NumPy installed in different directories, but python by default imports an old one. Any help? Here's where my Python is: Gonzo-vs-Kitties:~ brian$ which python /Library/Frameworks/Python.framework/Versions/2.7/bin/python Here's the version that Python imports: Gonzo...


Upgrade Python 2.4 to 2.6 or 3.0

I am running Python 2.4 on Redhat Linux 5. Any idea how to upgrade to either Python 2.6 or 3.0? Thanks in advance, Sum






Still can't find your answer? Check out these communities...



PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python



top