简体   繁体   中英

Can't find Brew installed packages on Mac M1 in Pycharm

I'm having trouble installing packages and using them in Pycharm. I've followed various threads (I'm new to Macs and seem to have tried everything) now I'm stuck.

In this case, I want to use the package xgboost.

I have brew installed, after launching a terminal using Rosetta:

%brew install xgboost Warning: xgboost 1.3.3 is already installed and up-to-date.

It appears installed OK here: /opt/homebrew/Cellar/xgboost

I also have Python installed here: /opt/homebrew/Cellar/python@3.9

But no matter how I configure an Interpreter in Pycharm, I can't seem to get the package recognised.

Where have I gone wrong?

Docs: https://xgboost.readthedocs.io/en/latest/build.html Pre-built binary wheel for Python

If you are planning to use Python, consider installing XGBoost from a pre-built binary wheel, available from Python Package Index (PyPI). You may download and install it by running

# Ensure that you are downloading one of the following:
#   * xgboost-{version}-py2.py3-none-manylinux1_x86_64.whl
#   * xgboost-{version}-py2.py3-none-win_amd64.whl
pip3 install xgboost

I am very unsure exactly how, but I've got this working.

Following: https://abbasegbeyemi.me/blog/homebrew-python-apple-m1

I changed the order of elements in my path: export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin

then a new interpreter in Pycharm using: usr/local/Cellar/Python@3.9/3.9.2_2/bin/python3.9

Now I can install packages just using pip in pycharm and it works.

This has been 6 hours of pain - warning to anyone who isn't well versed in macs, setting up an M1 for python dev was a complete nightmare for me.

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