如何在Spyder Editor(Python)上访问iCloud驱动器的模块

2024-05-12 23:10:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我希望导入一个保存在iCloud Drive文件夹中的模块

不改变python路径,当我尝试

'''from myfunctions.py'''

我得到:

'ModuleNotFoundError: No module named 'myfunctions.py'; 'myfunctions' is not a package'

我在终端中发现访问此文件的目录显然是/Library/Mobile*Documents/com~apple~CloudDocs/Documents,并在以下代码中尝试了此目录的变体:

sys.path.insert('/Library/Mobile*Documents/com~apple~CloudDocs/Documents/MY_FOLDER_NAME')

但这给了我一系列的错误。有没有办法在系统路径上添加到iCloud的路径(并从那里导入我的模块)

谢谢


Tags: 模块frompy路径目录文件夹comapple