Hi,
I am trying to use the academic edition of CPLEX on my mac and I want to use python to call CPLEX. I have downloaded and installed CPLEX academic edition studio. After running this command "
python /Applications/CPLEX_Studio221/python/setup.py install
" I get this error:
error: could not create '/Library/Python/3.8': Permission denied
Then I run the command with sudo
and then I get these errors like the below one:
def print(cls, out, model):
^
SyntaxError: invalid syntax
I then tried this command:
sudo python3 /Applications/CPLEX_Studio221/python/setup.py install
This time it seems that it is installing the CPLEX. But still, there is another error.
When I enter these commands in my terminal to see if I can import cplex,
python
import cplex
I get this error:
ModuleNotFoundError: No module named 'cplex'
But if I enter these commands in the terminal:
python3
import cplex
I would get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/homebrew/lib/python3.9/site-packages/cplex-22.1.0.0-py3.9.egg/cplex/__init__.py", line 44, in <module>
from .aborter import Aborter
File "/opt/homebrew/lib/python3.9/site-packages/cplex-22.1.0.0-py3.9.egg/cplex/aborter.py", line 13, in <module>
from ._internal import _procedural as _proc
File "/opt/homebrew/lib/python3.9/site-packages/cplex-22.1.0.0-py3.9.egg/cplex/_internal/__init__.py", line 20, in <module>
from . import _list_array_utils
File "/opt/homebrew/lib/python3.9/site-packages/cplex-22.1.0.0-py3.9.egg/cplex/_internal/_list_array_utils.py", line 14, in <module>
from . import _pycplex as CPX
File "/opt/homebrew/lib/python3.9/site-packages/cplex-22.1.0.0-py3.9.egg/cplex/_internal/_pycplex.py", line 13, in <module>
from . import _pycplex_platform
File "/opt/homebrew/lib/python3.9/site-packages/cplex-22.1.0.0-py3.9.egg/cplex/_internal/_pycplex_platform.py", line 26, in <module>
from cplex._internal.py39_cplex2210 import *
ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/cplex-22.1.0.0-py3.9.egg/cplex/_internal/py39_cplex2210.so, 2): no suitable image found. Did find:
/opt/homebrew/lib/python3.9/site-packages/cplex-22.1.0.0-py3.9.egg/cplex/_internal/py39_cplex2210.so: mach-o, but wrong architecture
/opt/homebrew/lib/python3.9/site-packages/cplex-22.1.0.0-py3.9.egg/cplex/_internal/py39_cplex2210.so: mach-o, but wrong architecture
Any ideas? I just want to say that when I enter the python
command in my terminal I get python 3 by default.
------------------------------
Shahrooz Pouryousef
------------------------------
#DecisionOptimization