「已解决」Python.h file not found on Ubuntu 20.04

ubuntu20.04配置opencv4时出现报错:

fatal error: Python.h: No such file or directory
   17 | #include <Python.h>
      |          ^~~~~~~~~~
compilation terminated.

解决方案

  1. 找到Python.h位置
locate Python.h

结果:

/home/cedric/anaconda3/envs/csgo_env/include/python3.6m/Python.h
/home/cedric/anaconda3/envs/csgo_env/lib/python3.6/site-packages/tensorflow/include/external/local_config_python/python_include/Python.h
/home/cedric/anaconda3/envs/decdiff_env/include/python3.8/Python.h
/home/cedric/anaconda3/envs/diffuser_env/include/python3.8/Python.h
/home/cedric/anaconda3/envs/stable_diffusion_webui/include/python3.10/Python.h
/home/cedric/anaconda3/include/python3.9/Python.h
/home/cedric/anaconda3/pkgs/python-3.10.6-haa1d7c7_1/include/python3.10/Python.h
/home/cedric/anaconda3/pkgs/python-3.6.9-h265db76_0/include/python3.6m/Python.h
/home/cedric/anaconda3/pkgs/python-3.8.16-h7a1cb2a_2/include/python3.8/Python.h
/home/cedric/anaconda3/pkgs/python-3.9.13-haa1d7c7_1/include/python3.9/Python.h
/snap/jupyter/6/include/python3.7m/Python.h
/usr/include/python2.7/Python.h
/usr/include/python3.10/Python.h
  1. 使用/usr/include/python3.10/Python.h
export CPATH=/usr/include/python3.10:$CPATH
export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
您可以通过以下步骤将D盘中的benchmarksql-5.0.tar.gz上传到Ubuntu 20.04.6上,并在ubuntu20.04.6下进行mysql压测: 1. 在Windows系统中,将benchmarksql-5.0.tar.gz文件拷贝到D:\目录下。 2. 打开一个SSH客户端(如PuTTY),连接到Ubuntu 20.04.6的远程主机。 3. 输入用户名和密码登录到Ubuntu 20.04.6系统。 4. 在Ubuntu 20.04.6系统中,创建一个目录来存放benchmarksql-5.0.tar.gz文件: ``` mkdir ~/benchmarksql ``` 5. 在Ubuntu 20.04.6系统中,安装`openssh-server`,以便从Windows系统中通过SCP命令上传文件到Ubuntu 20.04.6系统: ``` sudo apt-get update sudo apt-get install openssh-server ``` 6. 在Windows系统中,打开一个命令提示符窗口,使用SCP命令将benchmarksql-5.0.tar.gz文件上传到Ubuntu 20.04.6系统中: ``` scp D:\benchmarksql-5.0.tar.gz username@remote:~/benchmarksql/ ``` 其中,`username`是Ubuntu 20.04.6系统中的用户名,`remote`是Ubuntu 20.04.6系统的IP地址或主机名。 7. 在Ubuntu 20.04.6系统中,进入benchmarksql目录,解压benchmarksql-5.0.tar.gz文件: ``` cd ~/benchmarksql tar zxvf benchmarksql-5.0.tar.gz ``` 8. 在Ubuntu 20.04.6系统中,安装MySQL客户端和Java运行环境: ``` sudo apt-get update sudo apt-get install mysql-client default-jre ``` 9. 在Ubuntu 20.04.6系统中,创建数据库和用户: ``` mysql -u root -p CREATE DATABASE benchmark; GRANT ALL PRIVILEGES ON benchmark.* TO 'benchmark'@'localhost' IDENTIFIED BY 'password'; quit ``` 其中,`password`是您设置的密码。 10. 在Ubuntu 20.04.6系统中,进入benchmarksql目录,编辑bm.sql文件,将第6行的`use test;`改为`use benchmark;`,保存并退出。 11. 在Ubuntu 20.04.6系统中,运行benchmarksql: ``` ./runBenchmark.sh -du benchmark -dp password -dn benchmark -c 32 -t 32 -h localhost -mr SELECT -ms simple ``` 其中,`-du`是用户名,`-dp`是密码,`-dn`是数据库名,`-c`是并发连接数,`-t`是线程数,`-h`是主机名,`-mr`是测试模式,`-ms`是测试级别。 压测完成后,您可以在benchmarksql目录中查看日志文件。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值