0

Hello I am very new to Python. I am trying to install Pycurl on Mac OSX 10.10.1. I have bothy Python 2 and 3 installed on my mac. Although the python scripts I am running can only work with Python 3.

I tried both pip install pycurl and sudo easy_install pycurl.

pip install pycurl gave me command not found But I was able to install pycurl using sudo easy_install pycurl. However, it was automatically installed under python 2.7.

Therefore, when I tried to execute python scripts with python 3, ModuleNotFoundError: No module named 'pycurl'

First I thought of removing python 2 so pycurl would automatically be installed under python 3. After reading this thread, I am afraid of removing Python 2 would crash my OSX: How to uninstall Python 2.7 on a Mac OS X 10.6.4?

Can someone tell me how to make sure sudo easy_install would install pycurl under python 3 not 2? Thanks a lot.

Rui
  • 95
  • 1
  • 14
  • 3
    `python3 -m pip install pycurl` or `pip3 install pycurl` – anthony sottile Jul 10 '17 at 15:10
  • As above comment suggested, after posting my original question, I found that using pip3 to install pycurl is the way to go. Then I found I didn't have pip3 installed on my mac. After searching around, this thread had the way that worked for me: https://stackoverflow.com/questions/11268501/how-to-use-pip-with-python-3-x-alongside-python-2-x except that I got an error of "The directory or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag." – Rui Jul 10 '17 at 15:32
  • So the solution to above way to install pip3 is to use `sudo -H` instead of `sudo` to install pip3: `sudo -H python3.6 get-pip.py` Now I finally have pip3 and installed pycurl. After running the py scripts, I got another error `ImportError: pycurl: libcurl link-time version (7.37.1) is older than compile-time version (7.43.0)` I will open a new thread to ask question about this error. – Rui Jul 10 '17 at 15:34

0 Answers0