two pythons
So two pythons walk into a bar ...
just kidding. ;) Actually, this is a serious question. I noticed that the BLFS book has instructions for installing two versions of python. When I first encountered a package that required Python, it listed either as a dependency. As I know nothing about Python, it seemed best to just use the newer one, so I picked the three version over the two version. Things went for days to weeks without a problem. The past two days or so I've been going through the Xorg parts of the book, writing down dependencies and notes on paper, getting ready to install Xorg. Note: I've not started work on that, I'm in the planning phase. The Mesa package lists python 2, not 3, as a dependency. Oh. :o Is it possible to install 2 alongside of 3 so that the things I've already compiled that need 3 can still use it correctly? |
At the end for Python2, do...
make install At the end for Python3, do... make altinstall cd /bin ln -sv python3.61 python3 or ln -sv python3.6 python3, I can't remember the actual executable name ATM. Be aware that some packages will install Python components and choose 2 or 3 based upon finding python2 or python3, usually preferring python3. However, sometimes this isn't ideal, because dependent packages, on the package that was used and built an FFI for python3, but the dependent package hasn't yet been updated to Python3. Also, if you need to install a python package dependency like say LXML for CMake (or maybe its actually libarchive), be sure to use pip2 or pip3 appropriately in these cases. The bottom line is that not everything is Python3 ready yet and, regardless of the Python developer's arm twisting, it will be years before everything is moved over. Sometimes, in order to build a required python2 interface you must remove the python3 symlink to get that to happen. (Policy Kit, for example.) Personally, I don't install python3 until the shell is finished, though that keeps me on Gperf-3.04 & Systemd-232. (with BLFS packages) |
So I made a package for the 2 version. This way, I was then able to see what files it was putting where, yet without actually installing it and risking a trashing of anything.
piped directory listings to files, sorted them, ran "comm -12" on them. The results were surprising. No common files. No common directories, save for /usr/share/man1 and /usr/bin. Wow. This may be because I did not install the documention. Anyway, this means that neither python will stomp on anything from the other python! In view of that datum, I wonder if I should still do a "altinstall" rebuild/reinstall of 3? |
My recommendation was based upon what I read on the official Python website when I researched this very problem. I've run into issues using "make install" on both that using altinstall solved. In any case, programs that use Python don't seem to care how it is installed as long as it can find the python2 or python3 link when they go looking. The hardest part is remembering to use pip2 or pip3 when installing python packages needed by another program.
|
I think I understand better now. Thank you.
I've since made packages for 3 and, alt 3 (same source, just using "altinstall" option). I've compared the resultant directory trees. Both have the exact same files in the same arrangement, but diff reveals many differences between the contents of those files. Aha, OK. I've removed 3, installed 2 and then installed the altinstall version of 3. So far, no problems have emerged. On to Xorg, I guess, once backups are done. :) |
Don't forget the python3 link to the actual executable, or programs that need 3 won't find it.
|
Oh, and the differences inside the files are likely explicit specifications of Python3 instead of just Python.
|
So this is what is in my /usr/bin directory, python-wise:
Code:
bob@artemis:~/xc/xcb-proto-1.12 $ ls -la /usr/bin/*py* |
I have both pythons installed and both python2 and python3 modules installed.
The book says both can exist side-by-side. I haven't had any problems. I suggest not straying from the book. The writers know more than we do. Don't know why the patch to python3 didn't work. I did some work and found an answer. Here's a configure command that works: PYTHON=/usr/bin/python3 ./configure $XORG_CONFIG It configured ok and pulled in python3. Anyway, test it out and see what you think. You should still apply the patch first. It maybe necessary for this to work. I did. |
All times are GMT -5. The time now is 05:02 PM. |