install library in home directory
Yes, assuming the library is in /home/user/lib
. You can set use the LD_LIBRARY_PATH
environment variable to find the lib. LD_LIBRARY_PATH=/home/user/lib
, which will find the library. If you have to compile it yourself you will want to use configure --prefix=/home/user
.
I'm surprised that libstdc++.so.6
isn't available on the system already. Take a look in /usr/lib/x86_64-linux-gnu
. If could just be your program isn't multiarch aware.
install python package at current directory
You can use the target (t
) flag of pip install
to specify a target location for installation.
In use:
pip install -r requirements.txt -t /path/to/directory
to the current directory:
pip install -r requirements.txt -t .
What is the purpose of pip install --user ...?
pip defaults to installing Python packages to a system directory (such as /usr/local/lib/python3.4
). This requires root access.
--user
makes pip install packages in your home directory instead, which doesn't require any special privileges.
Installing software in home directory instead of /usr/bin/ in a server
To install modules in your HOME directory -pip install --user $PACKAGE_NAME
should do the trick.
This will install package in $HOME/.local/bin/$PACKAGE and the rest of package in $HOME/.local/lib/pythonx/site-packages/.
What is the use of pip's --user option on Windows?
It is indeed confusing how the Windows Python installer handles install location with default settings (which you most probably used).
According to the documentation, when you run the installer and just click "Install Now":
- You will not need to be an administrator (unless a system update for the C Runtime Library is required or you install the Python Launcher for Windows for all users)
- Python will be installed into your user directory
- The Python Launcher for Windows will be installed according to the option at the bottom of the first page.
Now, the option for the Python Launcher is also selected by default. This means, if your user account is in the "Administrator" group (which it typically is), Python (python.exe
) will be installed in your %LocalAppData%
directory (just as you have observed). However, the installer will still present you with a UAC prompt to confirm you have admin privileges, as it also wants to install the Python Launcher (py.exe
). You end up with a local, "just for me" Python installation in your user directory, though for some intangible reason the Launcher is installed "for all users".
If you really want to have a system-wide Python installation, you need to select "Customize installation" on the first screen of the installer, then click "Next", and check "Install for all users" — which is not checked otherwise. The install location will then default to your %ProgramFiles%
directory, usually C:\Program Files
.
When you do user-installs with pip
, it will put the packages in your %AppData%
directory, which is AppData\Roaming
in your user profile (as you have also observed). This is so that when you have a "roaming" account on a domain network, your personally installed packages follow you around, no matter from which computer on the network you log in. Obviously, that computer would have to have a system-wide Python installation "for all users" — of the Python interpreter, not the nearly irrelevant Python Launcher. This is where the default behavior, described above, makes absolutely zero sense, as you wouldn't be able to run the Python interpreter installed locally in some other user's profile when you log on to their computer.
On top of that, if you actually do use your profile to "roam" the domain network, all those --user
packages, which, more likely than not, comprise thousands of files, will slow down the log-in process: every one of those files has to be sync'ed between domain storage and the local computer.
Bottom line: If you want to set this up properly, customize your installation to make sure it's installed in some directory that is in fact accessible to all users. Personally, I like to put it in C:\programs\Python
, as I can then pip install
anything for everyone and don't even need an elevated prompt — which one would for writing to C:\Program Files
. Then again, requiring an elevated prompt may be advisable, depending on the circumstances.
Installing pip packages to $HOME folder
While you can use a virtualenv
, you don't need to. The trick is passing the PEP370 --user
argument to the setup.py
script. With the latest version of pip
, one way to do it is:
pip install --user mercurial
This should result in the hg
script being installed in $HOME/.local/bin/hg
and the rest of the hg package in $HOME/.local/lib/pythonx.y/site-packages/
.
Note, that the above is true for Python 2.6. There has been a bit of controversy among the Python core developers about what is the appropriate directory location on Mac OS X for PEP370-style user
installations. In Python 2.7 and 3.2, the location on Mac OS X was changed from $HOME/.local
to $HOME/Library/Python
. This might change in a future release. But, for now, on 2.7 (and 3.2, if hg
were supported on Python 3), the above locations will be $HOME/Library/Python/x.y/bin/hg
and $HOME/Library/Python/x.y/lib/python/site-packages
.
Related Topics
How to Find a Tutorial on The Writing of Makefiles
Set Docker Image Username at Container Creation Time
What Is Eof!! in The Bash Script
Is There a Libc in Kernel Space
Hidden File .Env Not Copied Using Docker Copy
Rodbc Not Recognizing My Odbc Settings
Only Accept Http Connections from Localhost in Go
How to Connect to Server: Postgresql on Ubuntu in Windows Subsystem for Linux
Redirecting Apache Logs to Stdout
How to Call Makefile Located in Other Directory
Sudo User Not Using Same Node Version
Why Does Pages Allocation with Order of 10 or 11 Using _Get_Free_Pages() Usually Fail
Vagrant Ssh -C and Keeping a Background Process Running After Connection Closed
Time Waste of Execv() and Fork()