174👍
There should be a binary called "pip2.7" installed at some location included within your $PATH variable.
You can find that out by typing
which pip2.7
This should print something like ‘/usr/local/bin/pip2.7’ to your stdout. If it does not print anything like this, it is not installed. In that case, install it by running
$ wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
$ sudo python2.7 get-pip.py
Now, you should be all set, and
which pip2.7
should return the correct output.
55👍
An alternative is to call the pip
module by using python2.7, as below:
python2.7 -m pip <commands>
For example, you could run python2.7 -m pip install <package>
to install your favorite python modules. Here is a reference: https://stackoverflow.com/a/50017310/4256346.
In case the pip module has not yet been installed for this version of python, you can run the following:
python2.7 -m ensurepip
Running this command will “bootstrap the pip installer”. Note that running this may require administrative privileges (i.e. sudo
). Here is a reference: https://docs.python.org/2.7/library/ensurepip.html and another reference https://stackoverflow.com/a/46631019/4256346.
- [Django]-How to check Django version
- [Django]-Migrating Django fixtures?
- [Django]-What is the difference between cached_property in Django vs. Python's functools?
1👍
as noted here, this is what worked best for me:
sudo apt-get install python3 python3-pip python3-setuptools
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
- [Django]-Select distinct values from a table field
- [Django]-Unique fields that allow nulls in Django
- [Django]-How to See if a String Contains Another String in Django Template
1👍
pip
has now dropped support for python2, therefore you can’t use python2 pip
You can’t find python2-pip
in apt-get
anymore, and you won’t get pip
when installing python2 from source
You can still install python modules using apt-get
. To install a python prepend ‘python-’ to the module name
apt-get install python-six # install six
- [Django]-Is this the right way to do dependency injection in Django?
- [Django]-How to make the foreign key field optional in Django model?
- [Django]-How to access a dictionary element in a Django template?