<div dir="ltr"><div dir="ltr"><div>Grazie per le risposte.</div><div>Avevo valutato (velocemente) se usare virtualenv o venv e la mia scelta era ricaduta sul primo perché ha alcune funzionalità in più, in particolare, paragonato a virtualenv<br></div><div><a href="https://virtualenv.pypa.io/en/latest/">https://virtualenv.pypa.io/en/latest/</a></div><div>"cannot create virtual environments for arbitrarily installed python versions (and automatically discover these),"</div><div><br></div>Il vero problema che sto cercando di aggirare è questo (su ubuntu 16.04):</div><div dir="ltr"><br></div><div dir="ltr"><span style="font-family:monospace">pip3 --version<br>Traceback (most recent call last):<br>File "/usr/bin/pip3", line 11, in <module><br>sys.exit(main())<br>File "/usr/local/lib/python3.5/dist-packages/pip/__init__.py", line 12, in main<br>from pip._internal.utils.entrypoints import _wrapper<br>File "/usr/local/lib/python3.5/dist-packages/pip/_internal/utils/entrypoints.py", line 4, in <module><br>from pip._internal.cli.main import main<br>File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/main.py", line 58<br>sys.stderr.write(f"ERROR: {exc}")<br>^<br>SyntaxError: invalid syntax</span></div><div dir="ltr"><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif">notare che avendo pip3 "rotto" di suo, non posso neanche usarlo per installare altri moduli nel virtual env.</span><br></span></div><div><span style="font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif">Ho provato quindi ad installare una versione specifica di pip:<br></span></div><div><span style="font-family:monospace"><a href="https://stackoverflow.com/questions/66212924/pip-sys-stderr-writeferror-exc-with-python-3-5">https://stackoverflow.com/questions/66212924/pip-sys-stderr-writeferror-exc-with-python-3-5</a></span></div><div><span style="font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif">Ho installato <br></span></div><div><span style="font-family:monospace">apt-get install python3-venv</span></div><div><br><span style="font-family:monospace"><span style="font-family:arial,sans-serif"></span></span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif">e provato a creare e attivare il virtual env<br><span style="font-family:monospace">python3 -m venv venv</span></span></span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif"><span style="font-family:monospace">source venv/bin/activate</span><br></span></span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif"><br></span></span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif">Installo con successo i moduli che mi servono:</span></span></div><div><span style="font-family:monospace">pip3 install htmlentities Jinja2 ldap3 python-zimbra six</span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif"><br></span></span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif">eseguo il mio script e va in crisi su qualcosa relativo a Jinja2</span></span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif"><br></span></span></div><div><span style="font-family:monospace">./myscript.py -h<br>Traceback (most recent call last):<br>File "./myscript.py", line 7, in <module><br>from jinja2 import Environment, FileSystemLoader<br>File "/opt/Custom/myscript/venv/lib/python3.5/site-packages/jinja2/__init__.py", line 5, in <module><br>from .bccache import BytecodeCache as BytecodeCache<br>File "/opt/Custom/myscript/venv/lib/python3.5/site-packages/jinja2/bccache.py", line 61<br>self.code: t.Optional[CodeType] = None<br>^<br>SyntaxError: invalid syntax</span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif"><br></span></span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif">Controllo la variabile d'ambiente</span></span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif"><br></span></span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif">echo $PATH<br><span style="font-family:monospace">/opt/Custom/ss-signatures/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin</span></span></span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif"><span style="font-family:monospace"><br></span></span></span></div><div><span style="font-family:monospace"><span style="font-family:arial,sans-serif"><span style="font-family:monospace"><span style="font-family:arial,sans-serif">E qua credo proprio che l'interprete sia troppo vecchio.</span><br></span></span></span></div></div>