https://www.python.org/ftp/python/cd /homecurl -O https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgztartar -xzvf Python-3.7.2.tgzPython-3-7-2cd Python-3.7.2./configuremkdir -p $HOME/usr/localmake altinstall prefix=$HOME/usr/local exec-prefix=$HOME/usr/localwait for install 5 minutes or so. Python 3 will be installed in $HOME/usr/local/bin.
ls $HOME/usr/local/bin2to3-3.7 easy_install-3.7 idle3.7 pip3.7 pydoc3.7 python3 python3.7 python3.7m python3.7m-config pyvenv-3.7/home/jsyu/usr/local/bin/python3.7Then, Python 3 shell starts.
Python 3.7.2 (default, Jan 28 2019, 13:06:35)[GCC 6.4.0] on linuxType "help", "copyright", "credits" or "license" for more information.>>> >>> To exit, just type
exit()Change directory to /where/you/install/python3/bin directory again.
cd $HOME/usr/local/binCreate your own Python 3 virtual environment file
ln -s pyvenv-3.7 pyvenv Edit pyvenv-3.7 using vi (or other text editor)
vi pyvenv-3.7At the first line of file, edit the absolute path of your python. So the correct path should be like this
#!/home/rangsiman/usr/local/bin/python3.7To make life easier, we do not always want to call Python 3 via its full path. So we can add it to PATH environment variable.
cd $HOME/usr/local/binln -s python3.7 python3$PATH. echo "# Python 3.7.2" >> ~/.bashrcecho "export PATH=\$HOME/usr/local/bin:\$PATH" >> ~/.bashrcsource ~/.bashrc python3Rangsiman Ketkaew