Installer pip et python 3¶
DSM 6 fournit Python 2 (2.7.12) dans /bin/python
Installer Python 3:¶
Il faut installer python 3 et pip depuis iPKGui, soit les paquets:
- python3
- py3-pip
- py3-setuptools
L'installation se fait dans /opt/bin/
$ which python3
/opt/bin/python3
$ which pip3
/opt/bin/pip3
Les modules sont ici:
/volume1/@optware/local/lib/python3.5/site-packages
(pip, setuptools)
Installer un module (mkdocs):¶
!!! Pour des problèmes de droit, l'installation se fait avec —user PermissionError: [Errno 13] Permission denied: '/opt/local/lib/python3.5/site-packages/click-6.7.dist-info'
$ pip3 install --user mkdocs
$ pip3 install --user klaus
Les modules sont installés ici:
/volume1/homes/bruno/.local/lib/python3.5/site-packages
L'applicatif est installé ici:
/volume1/homes/bruno/.local/bin/klaus
~/.local/lib/python3.5/site-packages/klaus/wsgi.py
Mettre à jour un module:¶
$ pip3 install --user --upgrade setuptools
Erreur à la création d'un environnement virtuel:¶
bruno@DS916:~/venv $ python -m venv lychee
Error: Command '['/volume1/homes/bruno/venv/lychee/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
Il faut le créer avec l'option --without-pip
.
bruno@DS916:~/venv $ python3 -m venv --without-pip letchee
bruno@DS916:~/venv $ source letchee/bin/activate
(letchee) bruno@DS916:~/venv $ curl https://bootstrap.pypa.io/get-pip.py | python3
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1842k 100 1842k 0 0 4757k 0 --:--:-- --:--:-- --:--:-- 4773k
Collecting pip
Downloading pip-20.2.4-py2.py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 3.1 MB/s
Collecting setuptools
Downloading setuptools-50.3.2-py3-none-any.whl (785 kB)
|████████████████████████████████| 785 kB 15.3 MB/s
Collecting wheel
Downloading wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-20.2.4 setuptools-50.3.2 wheel-0.35.1
(letchee) bruno@DS916:~/venv $ deactivate
bruno@DS916:~/venv $ source letchee/bin/activate
(letchee) bruno@DS916:~/venv $ l
$ grep 'ssh' /var/log/messages
$ tail -n100 /var/log/auth.log
Dernière mise à jour:
July 25, 2021