I was wonderi开发者_Python百科ng how you can append a variant to a port if you have already installed the port. For example I installed the 'vim' port and would like to go back and add the python25 variant. Do I need to delete vim and reinstall it? This is just an example, I would really like to know the process to do this for any port.
Thanks for any help, Greg
Only one variant of a MacPorts
port can be active at any one time. However, in MacPorts
terminology, multiple variants and/or versions of a port can be installed
simultaneously. Of those, at most one is active
, any others are inactive
. If you need to occasionally alternate between variants, you can activate a specific variant as needed. That will also automatically deactivate any conflicting active port. For example, here's a hypothetical vim
example (not fully tested!):
$ sudo port install vim +python26
$ sudo port clean vim
$ sudo port install vim +python31
$ sudo port echo installed |grep vim
vim @7.3.21_0+python26
vim @7.3.21_0+python31
$ sudo port activate vim @7.3.21_0+python26
# ... edit with Python 2
# ...
$ sudo port activate vim @7.3.21_0+python31
# ... edit with Python 3
# ...
I believe macports supports this natively now with the --enforce-variants
option. So in the above case, the command would be
$ sudo port upgrade --enforce-variants vim +python25
You do need to reinstall. There's no way to add a variant on afterwards – nor does it even make sense to do so. Variants affect settings during the build process.
精彩评论