Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python venv-调用ProcessPoolExecutor时没有这样的文件或目录?_Python_Python 3.x_Macos_Python Venv - Fatal编程技术网

Python venv-调用ProcessPoolExecutor时没有这样的文件或目录?

Python venv-调用ProcessPoolExecutor时没有这样的文件或目录?,python,python-3.x,macos,python-venv,Python,Python 3.x,Macos,Python Venv,我在Macbook Air M1上有一个venv设置。在执行以下代码时,我得到一个错误。我认为这是由于venv和macOS架构造成的 import concurrent.futures def process_file(): print('worked') with concurrent.futures.ProcessPoolExecutor() as executor: r = [executor.submit(process_file) for _ in range(10

我在Macbook Air M1上有一个
venv
设置。在执行以下代码时,我得到一个错误。我认为这是由于
venv
和macOS架构造成的

import concurrent.futures

def process_file():
    print('worked')

with concurrent.futures.ProcessPoolExecutor() as executor:
    r = [executor.submit(process_file) for _ in range(10)]

错误:

回溯(最近一次呼叫最后一次): 文件“”,第1行,在 文件“/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/Python3.8/multiprocessing/spawn.py”,第116行,在spawn_main中 exitcode=_main(fd,父节点_sentinel) 文件“/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/Python3.8/multiprocessing/spawn.py”,第125行,在_main中 准备(准备数据) 文件“/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/Python3.8/multiprocessing/spawn.py”,第236行,在prepare中 _从路径修复主路径(数据['init\u main\u from\u path']) 文件“/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/Python3.8/multiprocessing/spawn.py”,第287行,位于\u fixup\u main\u from\u路径中 main\u content=runpy.run\u路径(main\u路径, 文件“/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/Python3.8/runpy.py”,第262行,在运行路径中 代码,fname=\u从\u文件(运行\u名称,路径\u名称)获取\u代码\u 文件“/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/Python3.8/runpy.py”,第232行,从文件中获取代码 io.open_代码(fname)为f时: FileNotFoundError:[Errno 2]没有这样的文件或目录:'/Volumes/coding/sky/'


关于如何解决这个问题有什么想法吗?

我想这可能是与3.8和Mac有关的问题。请查看