How to install Python 2.7.10 installation without root/sudo permission and internet connection?
Use miniconda to install a standalone python. Then create environments as needed using the miniconda tool (conda).
See this answer for example usage.
If you already have a python installed (maybe the system python), you can skip downloading miniconda and use virtualenv to create standalone environments instead.
You can then use pip
to install the packages that you need.
How to build Python 3.5.2 from source without root
I have found a solution. You should install all packages in common directory
sqlite3 installation:
./configure --prefix=/path/to/python/installation/homedir
make -j && make install
tcl installation:
./configure --prefix=/path/to/python/installation/homedir
make -j && make install
tk installation:
./configure --prefix=/path/to/python/installation/homedir --with-tcl=/path/to/tcl/source/tcl8.6.8/unix
make -j && make install
Before Python installation you should set environment variables:
export LD_LIBRARY=/path/to/python/installation/homedir/lib
export TK_LIBRARY=/path/to/python/installation/homedir/lib
Edit setup.py
file and add path to sqlite3 lib to array:
sqlite_inc_paths = [ '/usr/include',
'/usr/include/sqlite',
'/usr/include/sqlite3',
'/usr/local/include',
'/usr/local/include/sqlite',
'/usr/local/include/sqlite3',
'/path/to/python/installation/homedir/include',
]
And Python installation:
./configure \
--prefix=path/to/python/installation/homedir \
make -j && make install
After that all should make correct.
Could not install packages due to an EnvironmentError: [Errno 13]
If you want to use python3+ to install the packages you need to use pip3 install package_name
And to solve the errno 13 you have to add --user
at the end
pip3 install package_name --user
EDIT:
For any project in python it's highly recommended to work on a Virtual enviroment, is a tool that helps to keep dependencies required by different projects separate by creating isolated python virtual environments for them.
In order to create one with python3+ you have to use the following command:
virtualenv enviroment_name -p python3
And then you work on it just by activating it:
source enviroment_name/bin/activate
Once the virtual environment is activated, the name of your virtual environment will appear on left side of terminal. This will let you know that the virtual environment is currently active.
Now you can install dependencies related to the project in this virtual environment by just using pip
.
pip install package_name
How to install python 2.7 in linux in local directory without admin rights?
Try: ./configure prefix=/x/y
and then make install
.
Then add the path /x/y/bin
in .bashrc
as:
PYTHONPATH=/home/something/python/bin
export PATH=$PYTHONPATH:$PATH
How to install python modules without root access?
In most situations the best solution is to rely on the so-called "user site" location (see the PEP for details) by running:
pip install --user package_name
Below is a more "manual" way from my original answer, you do not need to read it if the above solution works for you.
With easy_install you can do:
easy_install --prefix=$HOME/local package_name
which will install into
$HOME/local/lib/pythonX.Y/site-packages
(the 'local' folder is a typical name many people use, but of course you may specify any folder you have permissions to write into).
You will need to manually create
$HOME/local/lib/pythonX.Y/site-packages
and add it to your PYTHONPATH
environment variable (otherwise easy_install will complain -- btw run the command above once to find the correct value for X.Y).
If you are not using easy_install
, look for a prefix option, most install scripts let you specify one.
With pip you can use:
pip install --install-option="--prefix=$HOME/local" package_name
Issues installing Python library with binary dependency in virtualenv without sudo
You need to pass custom location of installed headers & shared objects when pip install
ing the python bindings:
$ CPPFLAGS='-I/home/ec2-user/environment/my_env/include' \
LDFLAGS='-L/home/ec2-user/environment/my_env/lib' pip install ta-lib
How to install PIP on Python 3.6?
pip
is bundled with Python > 3.4
On Unix-like systems use:
python3.6 -m pip install [Package_to_install]
On a Windows system use:
py -m pip install [Package_to_install]
(On Windows you may need to run the command prompt as administrator to be able to write into python installation directory)
Python 2.7 No module named _sqlite3 (no root access to machine, python is locally installed)?
This happened me recently. You need to apt-get install libsqlite3-dev
(on debian - sqlite-devel
possibly elsewhere) and recompile python.
Related Topics
Run a Python Script in Terminal Without the Python Command
Running Process of Remote Ssh Server in the Background Using Python Paramiko
How to Disable Stdout Buffer When Running Shell
Install Python3-Venv Module on Linux Mint
How to Get the Process Name by Pid in Linux Using Python
Loading a Config File from Operation System Independent Place in Python
How to Do Multiple Processes for Django, on My Wsgi Apache
How to Get an Windows Executable from My Kivy App (Pyinstaller)
On Linux Suse or Redhat, How to Load Python 2.7
How to Move .Conda from One Folder to Another at the Moment of Creating the Environment
What Conditions Result in an Opened, Nonblocking Named Pipe (Fifo) Being "Unavailable" for Reads
Mime.Hasimage()' Returns 'True' But 'Mime.Imagedata()' Returns 'None' on Linux
Install Tkinter and Python Locally