graphviz---cpp-python---matlab Fonts

graphviz.backend.execute.CalledProcessError: Command '[PosixPath('dot'), '-Ksfdp', '-Tpdf', '-O', 'process.gv']' returned non-zero exit status 1. [stderr: b'Format: "pdf" not recognized. Use one of: canon cmap cmapx cmapx_np dot eps fig gd gd2 gif gv imap imap_np ismap jpe jpeg jpg plain plain-ext png ps ps2 svg svgz tk vml vmlz vrml wbmp xdot\n']
----------------------------------------------------------------------

/*

win10 python3 graphviz出现问题
CalledProcessError: Command ‘[‘dot’, ‘-Tpdf’, ‘-O’, ‘测试图片.gv’]’ returned non-zero exit status 1. [st
首先,我已经完成了安装graphviz(版本2.44.1),以及pip install graphviz,并且将bin目录添加到环境变量里了,可运行(测试代码)依旧报错

from graphviz import Digraph

g = Digraph('测试图片')
g.node(name='a',color='red')
g.node(name='b',color='blue')
g.edge('a','b',color='green')
g.view()
1
2
3
4
5
6
7
试了网上的一些方法都没有成功,最后,我在cmd中检测了一下dot的版本,才发现问题。具体操作是:

打开cmd
运行:dot -v
出现问题:There is no layout engine support for “dot”…
运行:dot -c
没有提示(成功)
再次运行dot -v
结果如下图(成功)。详情也可参考:win10安装Graphviz
再次执行上述测试代码,没有报错,nice~
————————————————

                            版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
                        
原文链接:https://blog.csdn.net/kelanj/article/details/108394313

*/

In [5]: import graphviz

In [6]: g = graphviz.Graph('G', filename='process.gv', engine='sfdp')
   ...: 

In [7]: g.edge('run', 'intr')
   ...: g.edge('intr', 'runbl')
   ...: g.edge('runbl', 'run')
   ...: g.edge('run', 'kernel')
   ...: g.edge('kernel', 'zombie')
   ...: g.edge('kernel', 'sleep')
   ...: g.edge('kernel', 'runmem')
   ...: g.edge('sleep', 'swap')
   ...: g.edge('swap', 'runswap')
   ...: g.edge('runswap', 'new')
   ...: g.edge('runswap', 'runmem')
   ...: g.edge('new', 'runmem')
   ...: g.edge('sleep', 'runmem')
   ...: 

In [8]: g.view()
Out[8]: 'process.gv.pdf'

In [9]: evince: error while loading shared libraries: libstdc++.so.6: failed to map segment from shared object


//**************************************************888

https://lxadm.com/failed-to-map-segment-from-shared-object/

Fix 'Failed to Map Segment from Shared Object': A Comprehensive Troubleshooting Guide for Programmers

  • David Henegar

David Henegar

Apr 14, 20233 min read

In this guide, we will discuss the common causes and solutions for the error "Failed to Map Segment from Shared Object." This error can be encountered by programmers when working with shared libraries in Linux. By following this step-by-step guide, you can resolve this issue and get back to your development tasks in no time.

Table of Contents

  1. Understanding the Error
  2. Common Causes and Solutions
  1. FAQ

Understanding the Error

"Failed to Map Segment from Shared Object" is an error message that occurs when a process is unable to load a shared library into its address space. This error can be caused by various reasons, such as insufficient permissions, no-exec file systems, memory limitations, and corrupted library files. Before diving into the solutions, let's first understand what shared libraries are and how they work.

Shared libraries are a set of library functions that can be shared by multiple programs running on the same system. These libraries help reduce the memory footprint and disk space usage by allowing multiple programs to use the same code. Dynamic linking is the process of loading shared libraries into a program's address space during runtime.

Common Causes and Solutions

The following are the common causes of the "Failed to Map Segment from Shared Object" error and their respective solutions.

Insufficient Permissions

In some cases, the error is caused by insufficient permissions to read or execute the shared library files. To fix this issue, you can change the permissions of the library files using the following command:

chmod +rx /path/to/your/library.so

Replace /path/to/your/library.so with the actual path to the shared library file.

No-exec File System

If the shared library file is located on a file system mounted with the noexec option, the operating system will prevent execution of the library. To resolve this issue, you can remount the file system without the noexec option using the following command:

mount -o remount,exec /path/to/your/mountpoint

Replace /path/to/your/mountpoint with the actual path to the mount point of the file system.

Address Space Layout Randomization (ASLR)

ASLR is a security feature that randomizes the memory layout of a process, making it harder for an attacker to exploit vulnerabilities. However, in some cases, ASLR can cause issues with shared libraries. To temporarily disable ASLR for a specific program, you can use the following command:

setarch $(uname -m) -R /path/to/your/program

Replace /path/to/your/program with the actual path to the executable file of your program.

Note: Disabling ASLR can weaken your system's security, so use this solution with caution.

Memory Limitations

If your system is running low on memory, it can cause issues with loading shared libraries. To resolve this issue, you can increase the available memory by adding more RAM or creating a swap file. You can use the following command to create a 1 GB swap file:

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

To make the swap file permanent, add the following line to the /etc/fstab file:

/swapfile none swap sw 0 0

Corrupted Library Files

If the shared library files are corrupted, you may need to reinstall them to fix the issue. You can use your package manager to reinstall the library package. For example, on a Debian-based system, you can use the following command:

sudo apt-get install --reinstall libname

Replace libname with the name of the library package.

FAQ

Q: How do I find the path to a shared library?

You can use the ldconfig command with the -p option to list all the shared libraries in the system along with their paths. For example:

ldconfig -p | grep libname

Replace libname with the name of the library you are looking for.

Q: How do I check if a shared library is installed on my system?

You can use the ldconfig command with the -p option to list all the installed shared libraries in the system. For example:

ldconfig -p | grep libname

Replace libname with the name of the library you are looking for.

Q: How do I install a shared library on my system?

You can use your package manager to install a shared library. For example, on a Debian-based system, you can use the following command:

sudo apt-get install libname

Replace libname with the name of the library package.

Q: How do I know which shared libraries my program depends on?

You can use the ldd command to list the shared libraries that your program depends on. For example:

ldd /path/to/your/program

Replace /path/to/your/program with the actual path to the executable file of your program.

Q: Can I use static libraries instead of shared libraries?

Yes, you can use static libraries instead of shared libraries. However, static libraries are linked with your program at compile time and increase the size of your executable file. Additionally, static libraries do not benefit from shared memory usage and can lead to larger overall memory consumption.

  1. Shared Libraries in Linux
  2. Understanding Dynamic and Static Libraries
  3. How to Create and Use a Swap File on Linux
  4. ASLR: Understanding and Bypassing

-------------------------------- matlab fonts

Ubuntu高分屏下Matlab工具栏字体过小-CSDN博客

%在命令行内输入如下命令,其中2.0是放大的尺度,根据需要自行设置
s = settings;
s.matlab.desktop.DisplayScaleFactor;
s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2.0;

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值