If you've installed a custom version of Python 3, pip3 is already installed. To use it, make sure you've first followed all the instructions in the following article:
Next, run the following to activate your local Python environment.
[server]$ . ~/.bash_profile
You now have access to pip3. Confirm this by running the following:
[server]$ pip3 --version pip 9.0.1 from /home/username/opt/python-3.6.2/lib/python3.6/site-packages (python 3.6)
Installing custom modules within your virtual environment
When working with Python projects, it's always a good idea to create a virtual environment. This allows you to create an isolated environment, separate from the system version of Python. Any changes you make to this virtual environment only affects the single project, nothing else. In this way, it's a very safe way to test your projects as they can be deleted and rebuilt very easily. View the following article for further details.
Installing a virtualenv is important if you want to run 'pip'. Normally, pip attempts to install in the server's default Python system folder. This does not work since you do not have access to this folder. When you create a virtual environment, pip installs locally under your user, so you'll be able to install anything you like without error.
To use pip3 to easily install custom modules:
- Install a custom version of Python3 and create a virtual environment.
- Run the following command to activate this new virtual environment (change the directory to where you installed it):
[server]$ source my_project/bin/activate
- Use pip3 to install a module:
[server]$ pip3 install <module>
[server]$ pip3 install python-openstackclient
View the following links for further module examples: