There are multiple versions of Python on the same machine?

Official documentation on the Python Web site, how to install and run multiple versions of Python on the same machine on Linux?

I can find plenty of blog posts and answers, but I want to know if there is a "standard" official way of doing this?

Or is this all depends on the operating system?

 

solution


I think it is completely independent. Just install them, and then you can use the command/usr/bin/python2.5 and /usr/bin/python2.6. Link/usr/bin/python to link you want to use the default values.

In any case, all the libraries are in a separate folder (with version name).

If you want to manually compiled version, see the Python source code readme file:

Install multiple versions

On Unix and Mac systems, if you plan to use the same installation prefix (--prefix argument to configure script) to install multiple versions of Python, you must pay attention to install a different version does not overwrite the master python executable. Use "make altinstall" installation of all files and directories contain the major and minor versions, it can be used side by side. "Make install" will create $ {prefix} / bin / python3 , it refers to $ {prefix} /bin/pythonX.Y. If you plan to use the same prefix install multiple versions, you must determine which version (if any) is your "main" version. Use "make install" to install the version. Use "make altinstall" install all other versions.

For example, if you want to install Python 2.5,2.6 and 3.0,2.6 is the major version, you can do "make install" at 2.6 build directory, execute "make altinstall" in other directories.

Article reprinted from Python black hole Network

 

 

Guess you like

Origin www.cnblogs.com/pythonzhichan/p/11403446.html