Installing 3rd party Python modules on an Ubuntu Linux machine?
virtualenv
is the de facto Python standard for installing third party library cleanly. Read more about it here:
http://www.virtualenv.org/
Usage example:
daniel@redhotcar:~/tmp$ virtualenv myenv
New python executable in myenv/bin/python
Installing distribute....................................................................................................................................................................................done.
Installing pip...............done.
daniel@redhotcar:~/tmp$ cd myenv/
daniel@redhotcar:~/tmp/myenv$ bin/pip install mechanize
Downloading/unpacking mechanize
Downloading mechanize-0.2.5.zip (445Kb): 445Kb downloaded
Running setup.py egg_info for package mechanize
Installing collected packages: mechanize
Running setup.py install for mechanize
Successfully installed mechanize
Cleaning up...
daniel@redhotcar:~/tmp/myenv$ bin/python
Python 2.7.2+ (default, Oct 4 2011, 20:06:09)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mechanize
>>> mechanize
<module 'mechanize' from '/home/daniel/tmp/myenv/local/lib/python2.7/site-packages/mechanize/__init__.pyc'>
>>>
On Ubuntu, install virtualenv via apt-get install python-virtualenv
How to install Python module on Ubuntu
Most installation requires:
sudo python setup.py install
Otherwise, you won't be able to write to the installation directories.
I'm pretty sure that (unless you were root), you got an error when you did
python2.7 setup.py install
How do I install modules for Python 3.6 using Pip3 in Linux Ubuntu 16.04?
You can try pip3.6
or python3.6 -m pip
.
If both don't work, pip
is not installed for the new Python version.
Follow the instructions at https://pip.pypa.io/en/stable/installing/ but make sure to use python3.6
instead of just python
!
On some installations it might be necessary to use sudo
before python
/python3.6
.
Installing Python Library with ubuntu
The password which is requested is your ubuntu user password, What is happening is that you should run the command
sudo pip install lpthw.web
on your terminal,
when it prompts you to enter a password, it will mention the username such as
[sudo] password for <Your Username>:
you have to be an admin/SU to be able to make sudo changes to the system
Just insert your current password which you use to login when it prompts you to.
How to install a module for all users with pip on linux?
You might have a wrong umask
set as discussed here
From your last edit, I guess you umask
is set to 027
. Try to do
sudo pip uninstall loremipsum
umask 022
sudo pip install loremipsum
Related Topics
How to Validate Ip Address in Python
Python/Ipython Importerror: No Module Named Site
Detecting When a Child Process Is Waiting for Input
Show Default Value for Editing on Python Input Possible
Python Date String to Date Object
Pandas Dataframe Get First Row of Each Group
Type Hints: Solve Circular Dependency
Interprocess Communication in Python
Reshape Wide to Long in Pandas
Appending the Same String to a List of Strings in Python
Prevent Sleep Mode Python (Wakelock on Python)
Python3.6 Importerror: Cannot Import Name 'Main' Linux Rhel6
How to Postpone/Defer the Evaluation of F-Strings
Django Set Default Form Values
Convert Pandas.Series from Dtype Object to Float, and Errors to Nans