Python Forum
Linking with multiple python libraries
Thread Rating:
  • 2 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linking with multiple python libraries
#2
(Oct-13-2017, 01:14 AM)poijuggler Wrote: What will happen if two different versions of python are embedded and initialized within the same process?

Not sure what you mean by this. If you have two (or more) versions of Python, they each have their own respective 'home' directories. If you import a module, Python will search the directory of the version that called it, if it is not there, you will get an error, regardless if the module exists in the other versions directory.

If you mean can you import, let's say a module written in Python 3 into a script written in Python 2, I don't see why not, provided the Python 2 executable knows where to find it (for instance, both scripts are in the same directory). Of course it may not work entirely as you expect. You could also use 'subprocess' to run your Python 3 script then return to the Python 2 script.


(Oct-13-2017, 01:14 AM)poijuggler Wrote: the initialization of python will be managed globally and each app will obtain a sub-interpreter.

Again, it's unclear as to what you mean by 'sub-interpreter'.

DISCLAIMER: This is just me thinking out loud here as I've not tried to mix and match versions. Just seems like to much work for to little gain.

As to restructuring the company, that shouldn't be necessary, but they should know that Python 2 is a dead horse, so stop beating it. :-)
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Messages In This Thread
RE: Linking with multiple python libraries - by sparkz_alot - Oct-13-2017, 01:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python convert multiple files to multiple lists MCL169 6 1,648 Nov-25-2023, 05:31 AM
Last Post: Iqratech
  Adding libraries to embedded Python as a ZIP The_Oman 0 1,279 May-05-2023, 04:05 PM
Last Post: The_Oman
  Python script with local libraries zazas321 0 1,005 Jul-05-2022, 04:55 AM
Last Post: zazas321
  error in Linking two coroutines shankar 3 5,643 Jun-19-2020, 06:50 PM
Last Post: gogawaleankita
  linking with excel mhmdbarazi 1 2,067 Apr-23-2020, 04:18 AM
Last Post: buran
  Linking python to Google Sheets Charliefish1311 1 2,335 Jul-09-2019, 12:31 AM
Last Post: micseydel
  Installing Python and pointing it to required libraries hooiberg 2 4,359 May-13-2019, 05:55 PM
Last Post: ebolisa
  Package python script which has different libraries as a single executable or script tej7gandhi 1 2,653 May-11-2019, 08:12 PM
Last Post: keames
  Libraries needed for python install? burvil 7 20,234 Oct-18-2017, 04:55 AM
Last Post: burvil
  Adding libraries to Python 3.6.2 embedded hynek_compelson 1 4,854 Aug-10-2017, 09:01 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020