Python 3.8.2 - Macports configuration problem

Max Anglad max.anglad at gmail.com
Wed Apr 29 00:17:52 UTC 2020


Hello,

Still under El Capitan (OS 10.11) my native Python is in version 2.7

Since I have been using MacPorts for several years (but I am not an expert) I thought it would be easy to install the latest version of Python (3.8.2) through this channel. I have programmed in C and C++ for several years but I am still a beginner in Python.

So I installed the python38 Macport, then I installed pip and I also installed some Python packages via pip. OK :)

> port installed
...
  python38 @3.8.2_0 (active)
...

Everything seemed to be going well until I realized that the python38 Macport was a Python 3.8.2 (https://ports.macports.org/port/python38/summary) while my interpreter was still saying 3.8. 1 (python3 --version)

Upon closer inspection I realized that I had 2 Python 3.8 installations on my hard drive (maybe due to the fact that I tried PyCharm, I don't think I ever installed Python directly from https://www.python.org/downloads/)

One installed by Macports, here :

> /opt/local/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8
Python 3.8.2 (default, Mar 17 2020, 20:49:26) 
[Clang 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

And the second located in /Library :

> /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8
Python 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information

This second installation is seen by my PATH variable positioned in ~/.bash_profile  (which explain why my Python interprer is still in version 3.8.1)

> echo $PATH  
/Library/Frameworks/Python.framework/Versions/3.8/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

It is also under this path that my Python packages are installed : /Library/Frameworks/Python.framework/Versions/3.8/lib/site-packages

And there is almost no pakage under the first location : /opt/local/Library/.../site-packages


Questions :

Where is the right place to install the python38 port ?

How should the PATH variable be set so that Macports installations of Python are properly viewed ?

Are there other variables or links to position, in particular so that the Python packages are installed in the right place (therefore /opt/local/Library/.../site-packages) ? 

(I tried to upgrade pip under this location but it says that wheel is not installed, so I installed wheel, ... but before going further and maybe doing things wrong I preferred to inquire)


If it works, can I finally safely delete /Library/Frameworks/Python.framework/Versions/3.8/ directory ?

Thanks in advance for your advice, I'm a bit lost :-/



More information about the macports-users mailing list