Pycharm에서 코드를 실행하면 내 Excel 파일을 구문 분석하고 IDE에서 모든 것을 올바르게 병합합니다. 하지만 cx_Freeze을 사용하여 실행 파일에 빌드하면 작동이 멈 춥니 다. 실행 파일을 두 번 클릭하면 아무 것도 실행되지 않습니다. 검은 색 콘솔 창이 빠르게 깜박입니다. 무엇을 제공합니다. Pycharm에는 스택 추적이나 오류가 없습니다.Python 스크립트는 IDE에서 작동하지만 실행 파일에 내장 된 경우에는 작동하지 않습니까?
sideffect0 @[In:]
import numpy as np
import pandas as pd
#finds the path to a users pc.
userHome = os.path.expanduser('~')
directory = userHome + '/Desktop/Parsing Script/ParsingScriptOutputFile/'
workerList= (directory+'employeeList.csv')
managerList = (userHome+'/Parsing Script/ParsingScriptOutputFile/managerList.XLSX')
# specify 32 columns, no headers
employee = pd.read_csv(workerList, usecols=range(32), header=None, sep=",",engine='python') # read in the data
original_rows = employee.shape[0] # original number of rows
managers = pd.read_excel(managerList)
managers= managers[['Cost Center','Profit Center','User ID', 'Description','Email address','Person Responsible']]
# Left join so that the rows that do not match are not dropped from employee
# data
merged_df = pd.merge(employee, managers, on='key', how='left')
# Number of rows should be unchanged
# This should print out True
print(merged_df.shape[0] == original_rows)
#File called merged_data.csv returned to ParsingScriptOutputFile
return merged_df.to_csv(directory+'merged_data.csv', index=False, encoding='utf-8') # Save
(조언에 대한 감사) 전체 역 추적 문제는 모듈이 제대로 setup.py 파일에서 설치되지 않은
Traceback (most recent call last):
File "C:\Python\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 12, in <module>
__import__(name + "__init__")
File "C:\Python\lib\site-packages\cx_Freeze\initscripts\Console.py", line 24, in <module>
exec(code, m.__dict__)
File "csvProject1.py", line 3, in <module>
File "C:\Python\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Python\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Python\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Python\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Python\lib\site-packages\numpy\core\__init__.py", line 36, in <module>
from . import numeric
File "C:\Python\lib\site-packages\numpy\core\numeric.py", line 1842, in <module>
from .arrayprint import array2string, get_printoptions, set_printoptions
File "C:\Python\lib\site-packages\numpy\core\arrayprint.py", line 24, in <module>
from .fromnumeric import ravel
File "C:\Python\lib\site-packages\numpy\core\fromnumeric.py", line 15, in <module>
from . import _methods
ImportError: cannot import name '_methods'
같은 파일 경로입니까? 다른 컴퓨터에서'exe '를 시도 할 수 있기 때문에 묻는 중입니까? – WhatsThePoint
명령 줄에서'exe'를 실행하면 어떻게됩니까? – asongtoruin
나는 당신이 창문에 열려있는 명령 프롬프트 (Win + R -> cmd), 거기에서 프로그램을 실행 , 당신은 세부 사항과 추적을 얻을 것이다,이 질문에 추적을 추가 할 것입니다 –