Best way I found is to use https://github.com/pyenv/pyenv which downloads cpython sources and installs them, all with a normal user account. It also manages virtualenvs.
Here's a short walkthrough.
Requirements (from https://github.com/pyenv/pyenv/wiki/Com ... d-problems):
Code: Select all
# apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev
Code: Select all
# apt-get install libffi-dev
Code: Select all
$ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
$ cat >> ~/.bash_profile
export PATH="/home/<USERNAME>/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Code: Select all
$ pyenv install 3.5.3
$ mkdir myproject
$ cd myproject
$ pyenv local 3.5.3
$ pyenv virtualenv myvenv
$ pyenv local 3.5.3/envs/myvenv
$ pip install wheel
$ pip install cryptography
Code: Select all
$ python -c 'import sys; print(sys.version_info); import cryptography; print(cryptography.__version__)'
sys.version_info(major=3, minor=5, micro=3, releaselevel='final', serial=0)
2.1.2
Code: Select all
$ cd ..
$ python -c 'import sys; print(sys.version_info); import cryptography; print(cryptography.__version__)'
sys.version_info(
major=2, minor=7, micro=9, releaselevel='final', serial=0)
Traceback (most recent call last):
File "<string>", line 1,
in <module>
ImportError: No module named cryptography
Code: Select all
#!/usr/bin/env python