I have installed the latest version of Python on my CentOS 6.9 using the root user and this has been successful. I have basically run the following commands;
wget http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
tar xf Python-3.6.2.tar.xz
cd Python-3.6.2
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall
strip /usr/local/lib/libpython3.6m.so.1.0
wget https://bootstrap.pypa.io/get-pip.py
python3.6 get-pip.py
This has worked. I have exited the root login via ssh and have logged in with another Cpanel user to try and install and run a django app. I have created and activated a virtualenv by running this;
mkdir myproject
cd myproject
virtualenv mydjangoproject
source mydjangoproject/bin/activate
Now I am trying to install Django in my virtualenv using Python3.6 When I run this;
pip3.6 install django
I get the following error;
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/usr/local/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/usr/local/lib/python3.6/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/local/lib/python3.6/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/local/lib/python3.6/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/usr/local/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/local/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/usr/local/lib/python3.6/site-packages/pytz-2017.2.dist-info'
I am quite new to this so I am assuming a file cannot be created in /usr/local/lib/python3.6/ since I am not logged in as root. But I want to install the Django package in my virtualenv which makes sense since when a new version comes out I don't have to worry about using a global Django version.