FFGo: Difference between revisions

Jump to navigation Jump to search
4 bytes added ,  1 March 2016
→‎A word about pip and Python virtual environments: For self-compiled python installed in /opt/python3.5, the executables created by default under /opt/python3.5/bin are named 'python3' and 'python3.5', but not 'python'
(→‎General idea of the method: Mention that venv creation is currently broken on Debian unstable and point to my forum message giving two possible workarounds)
(→‎A word about pip and Python virtual environments: For self-compiled python installed in /opt/python3.5, the executables created by default under /opt/python3.5/bin are named 'python3' and 'python3.5', but not 'python')
Line 430: Line 430:
* one of Python 2.7 reachable via <tt>/usr/bin/python</tt>, with third-party packages located in <tt>/usr/lib/python2.7/dist-packages</tt> (this would be Debian or a derivative—other distributions are more likely to use /usr/lib/python2.7/site-packages);
* one of Python 2.7 reachable via <tt>/usr/bin/python</tt>, with third-party packages located in <tt>/usr/lib/python2.7/dist-packages</tt> (this would be Debian or a derivative—other distributions are more likely to use /usr/lib/python2.7/site-packages);
* one of Python 3.4 reachable via <tt>/usr/bin/python3.4</tt>, with third-party packages in <tt>/usr/lib/python3/dist-packages</tt><ref name="PYC-Repository-Directories">Python 3.2 and later are smart enough with <tt>.pyc</tt> files to allow using only one base directory for all Python versions, cf. ''PEP 3147: PYC Repository Directories'' in [https://docs.python.org/3/whatsnew/3.2.html What’s New In Python 3.2]</ref>;
* one of Python 3.4 reachable via <tt>/usr/bin/python3.4</tt>, with third-party packages in <tt>/usr/lib/python3/dist-packages</tt><ref name="PYC-Repository-Directories">Python 3.2 and later are smart enough with <tt>.pyc</tt> files to allow using only one base directory for all Python versions, cf. ''PEP 3147: PYC Repository Directories'' in [https://docs.python.org/3/whatsnew/3.2.html What’s New In Python 3.2]</ref>;
* and one of Python 3.5 that you compiled yourself and installed in <tt>/opt/python3.5</tt>, with the interpreter executable being <tt>/opt/python3.5/bin/python</tt>, and third-party packages located in <tt>/opt/python3.5/lib/python3.5/site-packages</tt>.
* and one of Python 3.5 that you compiled yourself and installed in <tt>/opt/python3.5</tt>, with the interpreter executable being <tt>/opt/python3.5/bin/python3</tt>, and third-party packages located in <tt>/opt/python3.5/lib/python3.5/site-packages</tt>.


If you run pip this way:
If you run pip this way:
<pre>/opt/python3.5/bin/python -m pip install FFGo</pre>
<pre>/opt/python3.5/bin/python3 -m pip install FFGo</pre>
(think of <code>/opt/python3.5/bin/python -m pip</code> as the name of the <tt>pip</tt> command) then FFGo will be installed for the interpreter you compiled yourself, with Python modules under <tt>/opt/python3.5/lib/python3.5/site-packages</tt> and executables in <tt>/opt/python3.5/bin</tt>. This should be fine. However, if you run this pip invocation with <tt>/usr/bin/python</tt> instead of <tt>/opt/python3.5/bin/python</tt>, then it will try to install things under <tt>/usr/lib/python2.7/dist-packages</tt> and in <tt>/usr/bin</tt>, which is certainly a  bad idea with most Linux distributions (and that would require root permissions, but don't do it unless you ''really'' know what you are doing). The same would apply if the command were to be run with <tt>/usr/bin/python3.4</tt>: it is a bad idea, because it would step on the toes of a Python installation from your Linux distribution.
(think of <code>/opt/python3.5/bin/python3 -m pip</code> as the name of the <tt>pip</tt> command) then FFGo will be installed for the interpreter you compiled yourself, with Python modules under <tt>/opt/python3.5/lib/python3.5/site-packages</tt> and executables in <tt>/opt/python3.5/bin</tt>. This should be fine. However, if you run this pip invocation with <tt>/usr/bin/python</tt> instead of <tt>/opt/python3.5/bin/python3</tt>, then it will try to install things under <tt>/usr/lib/python2.7/dist-packages</tt> and in <tt>/usr/bin</tt>, which is certainly a  bad idea with most Linux distributions (and that would require root permissions, but don't do it unless you ''really'' know what you are doing). The same would apply if the command were to be run with <tt>/usr/bin/python3.4</tt>: it is a bad idea, because it would step on the toes of a Python installation from your Linux distribution.


So, what can we do short of compiling Python ourselves? The canonical answer is to use pip <em>in a [https://docs.python.org/3/library/venv.html#venv-def virtual environment]</em>. Quoting the Python documentation:
So, what can we do short of compiling Python ourselves? The canonical answer is to use pip <em>in a [https://docs.python.org/3/library/venv.html#venv-def virtual environment]</em>. Quoting the Python documentation:
377

edits

Navigation menu