Hi, On Mon, Jan 7, 2019 at 11:11 AM mousumi sahu <mousumi.nina.sa...@gmail.com> wrote: > > Dear Sir, > I am trying to install python 2.7.10 on HPC. Python 2.6 has already been > install on root. I do not have root authority. Please suggest me how can I > do this.
Sorry - I replied to you directly, by accident. Take 2, with reply all: You need to do a local installation of Python, and set up your system to use that in preference to the one at the system level. Although it's possible to do this with various manual steps, there's a really handy tool you can use which will make your life easier, and allow you to manage multiple versions of Python, which might be useful, if you wanted, say, to be able to run both Python 2 and Python 3. The tool is called `pyenv`, and as long as you have a bash/zsh shell, and your system has a C compiler and associated tools already installed, you can install and use it. The simplest approach is to clone the tool it from git, modify your shell to use it, and then use it to install Python. Here's a sample way to set it up. This won't necessarily match your exact requirements, but you can try it, and please come back if you have any further questions: 1. Clone the git repo into your home directory git clone https://github.com/pyenv/pyenv.git ~/.pyenv Pyenv is very simple, conceptually. It's just a set of shell scripts to automate the process of fetching, compiling, and installing versions of Python, and then massaging your shell to make sure the versions you have installed are used in preference to anything else. So now you have the tool, you need to configure your shell to use it. I'm going to assume you're using Bash. 2. Make sure the contents of the pyenv tool is available on your path echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile Note - this might need to be .bashrc, or something else, depending on your os/distro/setup. However, in principle you're just making the pyenv tool (which itself is just a set of shell scripts) available at all times. 3. Set your shell to initialise the pyenv tool every time you start a new shell echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile Again: this might need to be .bashrc 4. Now open a new shell, and check you have pyenv available: $ pyenv pyenv 1.2.9-2-g6309aaf2 Usage: pyenv <command> [<args>] Some useful pyenv commands are: commands List all available pyenv commands local Set or show the local application-specific Python version global Set or show the global Python version shell Set or show the shell-specific Python version install Install a Python version using python-build uninstall Uninstall a specific Python version rehash Rehash pyenv shims (run this after installing executables) version Show the current Python version and its origin versions List all Python versions available to pyenv which Display the full path to an executable whence List all Python versions that contain the given executable See `pyenv help <command>' for information on a specific command. For full documentation, see: https://github.com/pyenv/pyenv#readme If you don't have pyenv working at this stage, come back and I'll help you troubleshoot. Assuming you do, continue: 5. Now you can install a version of Python, locally : pyenv install --list This shows you the various options of Pythons you can install. You want the latest 2.7: pyenv install 2.7.15 This will fetch the source code of Python, and compile and install it for you, and place it in your local shell environment, where you can use it. If this step doesn't work, it's probably because your system doesn't have a compiler and associated tools. I can help you troubleshoot that, but ultimately you'll need support from your system administrator at this point. Assuming it's install Python, now you just need to tell your shell that you want to use it: pyenv local 2.7.15 This will make your shell find your 2.7.15 installation ahead of the system python: $ python --version Python 2.7.15 Now you can run and use your Python. Any further questions, sing out. S. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor