[LINUX] Install the python library when you're not a sudoer (or if you don't want new users to be Sudoer, but you don't mind having the Python Library installed as you like)

Solution

Often when you start development, you can't get sudoer to put it in, but you need a library for development.

In such a case, manage with pyenv

pip install <package name> --user

This is ok

First time using pyenv

Note: If pyenv is not included, you will need sudo privileges to install it, so you have to ask the administrator to do it. (Should)

Refer to install

https://github.com/yyuu/pyenv#installation

mac

  1. Install with brew
brew install pyenv-virtualenv
  1. Add squid to ~ / .zshrc (if using zsh)
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi

3 Reread

source ~/.zshrc

ubuntu

Install pip (requires Sudo privileges)

sudo aptitude install python-pip

Install pyenv

pip install pyenv --egg

Fill in the .zshrc

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Reload .zshrc

source ~/.zshrc

Basic commands

Install a specific version of Python

pyenv install <version>

For example

pyenv install 3.5.1

Specify Python Version to be used in global

pyenv global <version>

Recommended Posts

Install the python library when you're not a sudoer (or if you don't want new users to be Sudoer, but you don't mind having the Python Library installed as you like)
What to do if you get the error RuntimeError: Python is not installed as a framework when trying to use matplitlib and pylab in Python 3.3
If you want a singleton in python, think of the module as a singleton
A convenient function memo to use when you want to enter the debugger if an error occurs when running a Python script.
It would be wise to write like boolean and "A" or "B" [Python] [But]
[Python] If you create a file with the same name as the module to be imported, an Attribute Error will occur.
How to write when you want to put a number after the group number to be replaced with a regular expression in re.sub of Python
[Django] A memorandum when you want to communicate asynchronously [Python3]
When you want to hit a UNIX command on Python
When you want to use multiple versions of the same Python library (virtual environment using venv)
Don't write Python if you want to speed it up with Python
When you want to keep the Sphinx documentation theme as usual
I want to know if you install Python on Mac ・ Iroha
If you want to assign csv export to a variable in python
What to do if you get "The session could not be opened" when installing CentOS on VirtualBox
What to do if you get a "Wrong Python Platform" warning when using Python with the NetBeans IDE
[Mac OS] What to do when Python is not installed as a framework. Is displayed when import matplotlib is performed.
What to do if you have installed PyCharm but shortcut keys such as `control + e` do not work
What to do if you get the error Target WSGI script'/var/www/xxx/xxx.wsgi' cannot be loaded as python module
[Python] How to save the installed package and install it in a new environment at once Mac environment