Hello to all! Slowly dealing with the issue of running Python code on the GoDaddy server. The question turned out to be interesting (here we considered how to organize an SSH connection through PuTTY to the server without it nowhere), and today we will figure out, finally, how to install Python on the GoDaddy server? 08.07.2019
First you need to check – what if Python is already installed? 😉 (it happens and this – at least in my case it was – true, Python was version 2.6.6 :(). To do this, go to your server via SSH (how to do this wrote earlier), and in the terminal we enter the following:
ls -la /usr/bin/python
Important: /usr/bin/python – the default location for Python executables
After that we use:
Python -V
to determine the version of installed Python.
So … you either have Python version 2. * or – it is not installed at all. In any case – if you feel the strength to install Python on your GoDaddy server yourself – continue!
We load the source archive to our server using the command:
wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz
After that, unzip the archive with the command:
tar xvzf Python-3.4.3.tgz
which will automatically create a directory called Python-3.4.3 /home/user/Python-3.4.3 and expand all the files inside the created directory.
We go inside the created directory:
cd Python-3.4.3
And install the new version of Python. For this we use the construction:
359405922670166eed74ed_000005
As a result, all the necessary files will be deployed and configured.
Now to install Pip and SetupTools do the following:
make
and then:
make install
It would seem – everything is ready, but … you need to add a path to our environment 🙂 To do this, go to:
cd $home
and after that we launch the Vi editor (I still haven’t figured out how to use it, so I went the other way — more on that below :)):
vi .bash_profile
and add to the configuration file:
#Python 3
export PATH = "$HOME/.local/ bin:$PATH"
If you, like me, do not know how to use the Vi editor, I am sure that my recipe will seem more attractive to you. To do this, using FileZilla, go to your server and download the .bash_profile file to your local computer – and then use the NotePad++ (please do not use Word or something similar to edit such files! Because they – editors – add a lot of garbage to the saved file, which negatively affects the results of work in general) – which is most suitable for these purposes – we add to the file all of the above, namely:
#Python 3 export PATH="$HOME/.local /bin:$PATH"
then save the file, upload it back to the server, and finally – update the environment with the command:
source ~/.bash_profile
After that, you can check the version of Python installed:
python3 -V
I hope I was able to answer the question “How to install Python on the GoDaddy server” 🙂
And yes – in case you need to run your Python code, for example, through Cron – use the construction:
/home/username/.local/bin/python3 Python-3.4.3/Code/test.py
where “Code” is the folder where your Python programs are located that you wish to execute on your server;) (at least I did so).
Thanks for attention! Do not forget to repost on social networks, if you liked this post, click on the advertising banner and ask questions in mail or in Telegram if there is a need for this 🙂