简体   繁体   中英

keeping current version while installing old version of python

CONTEXT

I have python 3.7.1 on my system ( macOS Mojave 10.14.1) but need python 3.6 for a specific package. I want to install python 3.6 but only for use in a virtual environment while keeping 3.7 as my "default" version (ie the one called when typing python3 ).

MAIN QUESTION

I want to be sure that installing v3.6 will not remove v3.7 from my system.

I presume the installation will change the symbolic link.

Is it safe to manually change the symbolic link back to v3.7?

I know that brew unlink takes care of packages installed with Homebrew. However,while my current version of python was installed with homebrew , it doesn't seem possible to install specific older versions with it, so I will have to install with the macOS installer from here . I am not sure what will happen to the symlinks.

I highly recommend docker for this problem. You will never leak out of virtual environments or break system packages with docker. Your dockerfile will explicitly define deps , not just python 3.6 exactly an image for which you can get from upstream, but also any other system deps. Then you can turn around and run the image anywhere you like once you build it. I have been developing in docker pretty much exclusively on my mac and love what it does for portability and replicability, not to mention being a great way to keep from having to handle package management in every execution environment.

https://docs.docker.com/v17.12/docker-for-mac/install/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM