我已经决定安装 MacOs Big Sur,现在我必须再次重新安装所有软件包...但我遇到了一些问题。
\n我没有太多使用终端的经验,但安装一些数据科学库需要很长时间。例如,安装 numpy 花了几分钟,而现在,自从我开始尝试安装 pandas lib 以来已经过去了 15 分钟
\npip3 install pandas\nDefaulting to user installation because normal site-packages is not writeable\nCollecting pandas Using cached pandas-1.1.4.tar.gz (5.2 MB)\nInstalling build dependencies ... -\nGetting requirements to build wheel ... done\nPreparing wheel metadata ... done\nRequirement already satisfied: numpy>=1.15.4 in ./Library/Python/3.8/lib/python/site-packages (from pandas) (1.19.4)\nCollecting pytz>=2017.2\nDownloading pytz-2020.4-py2.py3-none-any.whl (509 kB)\n |\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88| 509 kB 1.2 MB/s \nRequirement already satisfied: python-dateutil>=2.7.3 in ./Library/Python/3.8/lib/python/site-packages (from pandas) (2.8.1)\nRequirement already satisfied: six>=1.5 in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)\nBuilding …Run Code Online (Sandbox Code Playgroud) 自从我将 MacO 升级到 Big Sur 后,我的数据科学库出现了一些问题。我能够安装 numpy 和 pandas(尽管如本主题所述,它花费了不寻常的时间)。但是无法安装 Matplotlib。
我已经尝试了三件事......首先是默认的 MacOs 嵌入式 Phyton 3.8.2 。重新安装了 numpy,升级了 pip,但是当我尝试安装 Matplotlib 时。我有以下错误:
RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
RankWarning: Polyfit may be poorly conditioned
Run Code Online (Sandbox Code Playgroud)
后来,我在stackoverflow上看到了一些关于类似问题的建议,一个建议使用自制软件,所以我通过brew安装了Python 3.9.0。但是,当我尝试安装 Matplotlib 时,在尝试安装 Pillow 时仍然出现一个巨大的错误:
(.......) The headers or library files could not be found for jpeg,a required …Run Code Online (Sandbox Code Playgroud) 我在理解这 3 个示例之间的区别时遇到了一些麻烦。
#example1
list1 = [1,2,3,4]
list1= list1+[6]
list1.append(1000)
print("Example 1: ", list1)
# example 2
def f(j):
j= j + [6]
j.append(1000)
list2 = [1,2,3,4]
f(list2)
print("Example 2: ", list2)
# example 3
def f(j):
j.append(1000)
j= j +[6]
list3 = [1,2,3,4]
f(list3)
print("Example 2: ", list3)
Run Code Online (Sandbox Code Playgroud)
输出:
在第一个我没有使用(+)和(.append)一些简单的加法,它工作得很好。
在第二个我创建了一个功能。我想我明白了结果。在我看来,它保持不变,因为我在原始列表中所做的更改仅在本地进行,因此,功能完成后,原始列表保持不变。我对吗?
在第三个我无法理解。因为它和第二个完全一样,我只是改变了元素的顺序,但是输出完全不同。