如何删除分析* .gcda:无法使用python virtualenv构建器打开错误?

sur*_*190 4 python jenkins

jenkins输出中,出现以下错误。这是一个问题还是可以将其静音?

profiling:/opt/Python-3.6.1/Python/structmember.gcda:Cannot open
profiling:/opt/Python-3.6.1/Python/getcompiler.gcda:Cannot open
profiling:/opt/Python-3.6.1/Objects/odictobject.gcda:Cannot open
profiling:/opt/Python-3.6.1/Objects/enumobject.gcda:Cannot open
profiling:/opt/Python-3.6.1/Objects/descrobject.gcda:Cannot open
profiling:/opt/Python-3.6.1/Objects/cellobject.gcda:Cannot open
profiling:/opt/Python-3.6.1/Objects/bytes_methods.gcda:Cannot open
profiling:/opt/Python-3.6.1/Objects/accu.gcda:Cannot open
profiling:/opt/Python-3.6.1/Parser/myreadline.gcda:Cannot open
profiling:/opt/Python-3.6.1/Parser/parser.gcda:Cannot open
profiling:/opt/Python-3.6.1/Modules/xxsubtype.gcda:Cannot open
profiling:/opt/Python-3.6.1/Modules/symtablemodule.gcda:Cannot open
profiling:/opt/Python-3.6.1/Modules/zipimport.gcda:Cannot open
profiling:/opt/Python-3.6.1/Modules/stringio.gcda:Cannot open
profiling:/opt/Python-3.6.1/Modules/textio.gcda:Cannot open
profiling:/opt/Python-3.6.1/Modules/bufferedio.gcda:Cannot open
profiling:/opt/Python-3.6.1/Modules/bytesio.gcda:Cannot open
profiling:/opt/Python-3.6.1/Modules/fileio.gcda:Cannot open
profiling:/opt/Python-3.6.1/Modules/iobase.gcda:Cannot open
profiling:/opt/Python-3.6.1/Modules/_iomodule.gcda:Cannot open
profiling:/opt/Python-3.6.1/Modules/_localemodule.gcda:Cannot open
Run Code Online (Sandbox Code Playgroud)

我从debian 8服务器上的源代码构建了python 。

Jam*_*ens 7

这些gcda文件是gcc分析记录,用于查看 CPU 花费大部分时间在哪些功能上。这会告诉您在优化代码时可以从哪里获得最大收益。

您可以使用配置选项保留 Python 代码意见,但不能进行分析--enable-optimizations --disable-profiling。嗯,为我工作。

正如configure脚本会告诉您的那样,如果您没有 ,--enable-optimizations您将失去最佳性能。

可能正在获取gcda文件,因为您在中途中断了 Python 构建。当您使用--enable-optimizationsPython 构建运行时,分三个阶段运行

  • 构建代码
  • 运行所有test模块来分析代码
  • 重新编译代码以根据分析对其进行优化

通常认为该test阶段只是检查代码是否正常工作,因为它看起来像它在做什么,但请耐心等待并离开它,它会再次编译,第二次省略分析。

因此,最好在有--enable-optimizations和没有编译的情况下进行编译,然后--disable-profiling等待,因为您应该以这种方式获得更好的代码。


小智 6

我通过更改所有者来解决此问题。我正在使用./configure --enable-optimizations使用Python 3.6.3构建来设置homeassantant。从我的虚拟环境中,我得到了这些错误,但已将其纠正:从su / root帐户

sudo chown -R homeassistant:homeassistant /home/pi/Python-3.6.3
Run Code Online (Sandbox Code Playgroud)

我以为这也许可以帮助其他人;)祝你有美好的一天!再见!


ral*_*ien 5

当我这样做时,这件事发生在我身上./configure --enable-optimizations。如果您删除--enable-optimizations,然后再次编译并安装它-这些消息不再显示。

概括起来,这是一个带有新版本Python的示例:

wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
tar xvf Python-3.6.3.tgz
cd Python-3.6.3
./configure
make
sudo make altinstall
python3.6
Run Code Online (Sandbox Code Playgroud)