报错如下:
Traceback (most recent call last):
File "F:/D/code/excel/csv_excel.py", line 4, in <module>
import pandas as pd
File "D:\software\anaconda\envs\TQ\lib\site-packages\pandas\__init__.py", line 11, in <module>
__import__(dependency)
File "D:\software\anaconda\envs\TQ\lib\site-packages\numpy\__init__.py", line 144, in <module>
from . import core
File "D:\software\anaconda\envs\TQ\lib\site-packages\numpy\core\__init__.py", line 100, in <module>
from . import _add_newdocs_scalars
File "D:\software\anaconda\envs\TQ\lib\site-packages\numpy\core\_add_newdocs_scalars.py", line 87, in <module>
add_newdoc_for_scalar_type('byte', [],
File "D:\software\anaconda\envs\TQ\lib\site-packages\numpy\core\_add_newdocs_scalars.py", line 62, in add_newdoc_for_scalar_type
alias_doc += ''.join(":Alias on this platform ({} {}): `numpy.{}`: {}.\n ".format(platform.system(), platform.machine(), alias, doc)
File "D:\software\anaconda\envs\TQ\lib\site-packages\numpy\core\_add_newdocs_scalars.py", line 62, in <genexpr>
alias_doc += ''.join(":Alias on this platform ({} {}): `numpy.{}`: {}.\n ".format(platform.system(), platform.machine(), alias, doc)
File "D:\software\anaconda\envs\TQ\lib\platform.py", line 897, in system
return uname().system
File "D:\software\anaconda\envs\TQ\lib\platform.py", line 785, in uname
node = _node()
File "D:\software\anaconda\envs\TQ\lib\platform.py", line 588, in _node
import socket
File "D:\software\anaconda\envs\TQ\lib\socket.py", line 52, in <module>
import os, sys, io, selectors
File "D:\software\anaconda\envs\TQ\lib\selectors.py", line 12, in <module>
import select
File "F:\D\code\excel\select.py", line 6, in <module>
dirs = os.listdir(path)
FileNotFoundError: [WinError 3] 系统找不到指定的路径。: 'H:\\TQQ\\rain\\csv\\txt\\2018'
一开始以为是环境的问题,后面以为是编译器的问题,仔细排查之后发现项目中有一个名为select.py的文件,这个文件可能与os库中的文件命名有冲突,故将其改名后代码即可正常运行。