Python 蟒蛇——熊猫可以';找不到文件,但numpy可以

Python 蟒蛇——熊猫可以';找不到文件,但numpy可以,python,pandas,numpy,file,path,Python,Pandas,Numpy,File,Path,我在这里完全不知所措。我试图在pandas中打开一个txt文件,我尝试了多种不同的方法,但每次都收到相同的错误消息。”没有这样的文件“ 奇怪的是这 import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import PercentFormatter full_file = np.loadtxt('2_Feature_Test.txt', delimiter=',') …工作完全正常,但这 imp

我在这里完全不知所措。我试图在pandas中打开一个txt文件,我尝试了多种不同的方法,但每次都收到相同的错误消息。”没有这样的文件“

奇怪的是这

import numpy as np
import matplotlib.pyplot as plt
from   matplotlib.ticker import PercentFormatter

full_file = np.loadtxt('2_Feature_Test.txt', delimiter=',')
…工作完全正常,但这

import pandas as pd
import matplotlib.pyplot as plt
from   matplotlib.ticker import PercentFormatter

full_file = pd.read_csv('2_Feature_Test.txt', sep=',')
…没有

不管是完整路径,也不管是反斜杠还是正斜杠,也不管原始字符串是否以r作为前缀。这个问题是否与熊猫和努比在不同的地方有关?我不知道。拜托,如果你有什么想法的话,我洗耳恭听,只想弄清真相。谢谢大家

如果有帮助,这是我收到的完整错误消息

Traceback (most recent call last):
  File "C:\Users\Pat Oaks\Documents\txt_files\Thonny\lib\site-packages\thonny\workbench.py", line 1449, in event_generate
    handler(event)
  File "C:\Users\Pat Oaks\Documents\txt_files\Thonny\lib\site-packages\thonny\assistance.py", line 138, in handle_toplevel_response
    self._explain_exception(msg["user_exception"])
  File "C:\Users\Pat Oaks\Documents\txt_files\Thonny\lib\site-packages\thonny\assistance.py", line 178, in _explain_exception
    + _error_helper_classes["*"]
  File "C:\Users\Pat Oaks\Documents\txt_files\Thonny\lib\site-packages\thonny\assistance.py", line 176, in <listcomp>
    for helper_class in (
  File "C:\Users\Pat Oaks\Documents\txt_files\Thonny\lib\site-packages\thonny\plugins\stdlib_error_helpers.py", line 555, in __init__
    super().__init__(error_info)
  File "C:\Users\Pat Oaks\Documents\txt_files\Thonny\lib\site-packages\thonny\assistance.py", line 478, in __init__
    self.last_frame_module_source = read_source(self.last_frame.filename)
  File "C:\Users\Pat Oaks\Documents\txt_files\Thonny\lib\site-packages\thonny\common.py", line 252, in read_source
    with tokenize.open(filename) as fp:
  File "C:\Users\Pat Oaks\Documents\txt_files\Thonny\lib\tokenize.py", line 447, in open
    buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'pandas\\_libs\\index.pyx'
回溯(最近一次呼叫最后一次):
文件“C:\Users\Pat Oaks\Documents\txt\u files\Thonny\lib\site packages\Thonny\workbench.py”,第1449行,在事件中生成
处理程序(事件)
文件“C:\Users\Pat Oaks\Documents\txt\u files\Thonny\lib\site packages\Thonny\assistance.py”,第138行,在句柄\u顶级\u响应中
自我解释异常(消息[“用户异常”])
文件“C:\Users\Pat Oaks\Documents\txt\u files\Thonny\lib\site packages\Thonny\assistance.py”,第178行,在解释异常中
+\u错误\u帮助程序\u类[“*”]
文件“C:\Users\Pat Oaks\Documents\txt\u files\Thonny\lib\site packages\Thonny\assistance.py”,第176行,在
在中为帮助者_类(
文件“C:\Users\Pat Oaks\Documents\txt\u files\Thonny\lib\site packages\Thonny\plugins\stdlib\u error\u helpers.py”,第555行,在初始化中__
super()。\uuuu初始化(错误信息)
文件“C:\Users\Pat Oaks\Documents\txt\u files\Thonny\lib\site packages\Thonny\assistance.py”,第478行,在uu init中__
self.last\u frame\u module\u source=读取源(self.last\u frame.filename)
文件“C:\Users\Pat Oaks\Documents\txt\u files\Thonny\lib\site packages\Thonny\common.py”,第252行,位于read\u源代码中
使用tokenize.open(文件名)作为fp:
文件“C:\Users\Pat Oaks\Documents\txt\u files\Thonny\lib\tokenize.py”,第447行,打开
缓冲区=\u内置\u打开(文件名'rb')
FileNotFoundError:[Errno 2]没有这样的文件或目录:“pandas\\\\u libs\\index.pyx”

更新:由于阅读错误消息的人比我更有耐心,我意识到问题最有可能发生在pandas安装上。通过conda安装pandas安装pandas失败,原因是“找不到指定的过程”。这可能与问题有关吗?以前有人看到过吗?

如评论所示我说过,很明显,丢失的文件是其中一个,而不是您试图读取的文件

尝试强制重新安装熊猫

pip install -I pandas
或者,如果使用蟒蛇

conda install pandas --force-reinstall

请注意,pandas找不到文件
'pandas\\\\ libs\\index.pyx'
。这是一个完全不同的文件。您是说pandas安装不正确,还是不完整?不管是什么问题,出于某种未知的原因,我所知道的应该工作的代码没有。看起来pandas有问题。@lunardiploma是的,他们说熊猫安装有问题。请查看错误:
FileNotFoundError:[Errno 2]没有这样的文件或目录:'pandas\\\ libs\\index.pyx'
。该文件不是
'2\u Feature\u Test.txt'
是的,它看起来像是熊猫安装问题。我手头没有Windows,所以无法检查,但是
pandas\\ libs\index.pyx
将是pandas发行版中的cython文件。哇..强制安装不起作用。我收到了同样的错误消息,但它确实提供了一些有用的信息。显然,在某个时候,一个文件libssl-1_1-x64 DLL已损坏或删除。解决方案是在MiniConda3\DLL中复制此文件的一个版本,并用它替换MC3\libary\bin中的一个。我刚刚成功地在完成此操作后重新安装了pandas。感谢您的帮助每个人。