pyinstaller:“没有这样的文件或目录”,但是程序不断执行

时间:2019-04-27 10:40:12

标签: python machine-learning pycharm pyinstaller filenotfoundexception

我在Mac上使用Pyinstaller。我能够通过运行pyinstaller --onefile --paths /Users/wnba/PycharmProjects/a2_part3/venv/lib/python3.7/site-packages gp.py创建可执行文件,但是当我运行创建的文件gp时,它出现了一个奇怪的错误,提示[3723] Failed to execute script gp exitTraceback (most recent call last): File "gp.py", line 56, in <module> File "gp.py", line 12, in read_file FileNotFoundError: [Errno 2] No such file or directory: '-B'

我在第12行附近的gp.py如下所示:

import numpy as np
import sys
import re
import gplearn
from gplearn.genetic import SymbolicClassifier
from sklearn.metrics import roc_auc_score
def read_file(path):
    with open(path, 'r') as sourcefile: # this is line 12 
    sourcelines = sourcefile.read()

我解析args的方式是:

read_file(sys.argv[1])

能否请您指出出什么问题了?非常感谢

0 个答案:

没有答案