1

I am new to Python and there are some things which I am not able to apprehend. Questions may seem like very kiddish, so bear with me.

As you know, Ubuntu comes with an outdated Python version. I wished to use the latest python. But since it is recommended not to override the system's python, I installed virtualenv.

I installed pip first, using sudo apt-get install python-pip.

Then installed virtualenv, using sudo pip install virtualenv, and did all the configurations required to link it to the latest python.

The questions which I want to ask are-

  1. Where does the command pip install <module> store the module in the system? I am asking this question because there is a section in this link, which says "Installation into Python". I was confused by this, thinking whether installing a python module is sensitive to which python version I am using. If it is so, then where does pip install the module if I am using virtualenv and otherwise.

  2. I have manually installed Apache HTTP Server 2.4.23 using this link. While installing mod_wsgi using command sudo pip install mod_wsgi, I am getting this error

    RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages.

I searched for it and the solution is to install developer package of Apache. But the problem is that I am not able to find it anywhere on it's site. I want to install it manually. What to do? Also, If I install it through sudo apt-get install apache2-dev, Will there be any difference ?

Note: As mentioned on this link, I have already set the value of APXS environment variable to the location of apxs script, which is /usr/local/apache/bin/apxs.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
ks_mani
  • 169
  • 1
  • 5
  • 18
  • I use `Linux Mint` based on `Ubuntu 14` and it doesn't have problem after updating to 2.7.12 and 3.5.1. I even install Python from unofficial repo for Ubuntu - https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes – furas Oct 16 '16 at 18:41
  • import module (ie. `import requests`) and print `__file__` (`print(requests.__file__)`) to see where module is installed. – furas Oct 16 '16 at 18:43
  • every Python version has own folder for modules. You have to use `pip2` and `pip3` to install for `Python2` or `Python3`. When you create `virtualenv` it create own folder for modules and own `pip` for this folder. – furas Oct 16 '16 at 18:47
  • `-dev` mostly means `"C/C++ header files (*.h)"` and you need it when you have to compile extension for Apache. Better use `apt-get` (or shorter `apt`) to install `Apache` (or `nginx`) – furas Oct 16 '16 at 18:50
  • Your two questions seem unrelated and really should have been two posts. One about pip. The other about Apache2 – OneCricketeer Oct 16 '16 at 18:52
  • The ``virtualenv`` command itself doesn't help you with installing a different version of Python. The wording of question is really confusing as you seem to think it does. What the name of the system Apache dev package is depends on what Ubuntu version you are using. You do not state what Ubuntu version you are using so not possible to tell you what package name is. ``APXS`` could be getting ignored because you didn't use it on same line as ``pip``, or didn't export it if set separately. – Graham Dumpleton Oct 16 '16 at 20:41

1 Answers1

0

Concerning 1., if I have well understood, you would like to have the last 2.7 or 3.5 Python version on your distribution. Actually, you can have multiple python distribution on your distribution. I would suggest you to have a look on conda/anaconda (https://www.continuum.io/downloads) : it is very powerful and i think it would better suit you than virtualenv: virtualenv would enable you to create a separate python environnement, but it would not install a newer version of Python.

Concerning 2, I am not an expert in Apache2, but I would have used apt-get instead of re-compiling apache. While compiling, you may need some dependancies to build the mod_wsgi module. So I think it is way more easy to use the pre-built packages from your ubuntu.

jcgiret
  • 728
  • 7
  • 12