简体   繁体   中英

I can't import yfinance and pandas in JupyterNotebook or pycharm. (Mac M1)

I'm working on M1. I tried to import pandas in Jupyter. But it doesn't work.

When I check it using 'pip show pandas' in Jupyter, it appears like this. enter image description here

But I can't import Pandas in Jupyter. Error appears. enter image description here

The image is too big, so error message is cropped. Here is the last sentence of the error message.

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/_libs/interval.cpython-38-darwin.so, 0x0002): tried: '/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/_libs/interval.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))

When I checked the place where python3 is installed, it appears like this.

~> which python3 /Library/Frameworks/Python.framework/Versions/3.8/bin/python3

Jupyter's Version : 3.4.3

pip's Version : 22.1.2 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)

What do you think is problem?

I used to have some similar issues with importing after I pip installed the needed modules piecemeal. To fix this, I started from scratch and used Anaconda on both mac and windows machines to install python and the needed modules without any further issues.

https://www.anaconda.com/products/distribution#Downloads

I also have been using more virtual environments, which I would recommend looking up afterwards.

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