0
votes

I am trying to compile a code that works with Python 3.6. On my computer (Ubuntu 20.04), Python 2.7 and 3.8 comes pre-installed. Therefore, I manually installed python 3.6 using apt-get (I am not using any third party software e.g. Anaconda). I've also installed the development branch of 3.6 (something like libpython-dev).

However, when the code compiles, it needs to install certain packages (mpi4py, h5py etc) which should correspond/build with Python 3.6. However, the process detects Python version as 3.8. I have done the following in order to force the system to use 3.6 version:

  1. In my bashrc file, I have created an alias for python (and python3) as python3.6

    alias python='python3.6'

    alias python3='python3.6'

  2. The output of 'sudo update-alternatives --config python' is:

enter image description here

The output of commands python --version, python -V is Python 3.6.13. Therefore, I do not understand as to how to make the code works with 3.6. Please help!

1
you don't need to make system-wide changes, use venv instead. python3.6 -m venv venv source venv/bin/activate, then use python and pip directly - sify
@sify Is it a package? - Tanmay Agrawal
venv is a module added since python 3.3. In ubuntu you may need to execute sudo apt install python3-venv to install this module. Another option is to use virtualenv directly, venv module is just a subset of it. - sify

1 Answers

0
votes

You can install these packages using : python3 -m pip install mpi4py(package_name) or

python3.6 -m pip install package_name