Ubuntu18.04安装TensorFlow 遇到错误 No such file or directory: ‘c++‘: ‘c++‘

本文介绍了在安装TensorFlow过程中遇到的错误“Nosuchfileordirectory:‘c++’:‘c++’”,并给出了详细的解决方案,包括更新pip版本和安装setuptools等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错内容如下. No such file or directory: ‘c++’: ‘c++’

Collecting grpcio>=1.8.6 (from tensorflow==1.11.0)
  Using cached https://files.pythonhosted.org/packages/8c/34/7dafc9052bd9b2b41c5a8912aeeca01e179d16de17e9c275633d4b807330/grpcio-1.38.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-09xp2toh/grpcio/setup.py", line 255, in <module>
        if check_linker_need_libatomic():
      File "/tmp/pip-build-09xp2toh/grpcio/setup.py", line 205, in check_linker_need_libatomic
        stderr=PIPE)
      File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
        restore_signals, start_new_session)
      File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'c++': 'c++'

后经过百度, 得知是pip版本太低了. 需要更新. 然后还缺少setuptools
执行下面的命令即可

$ pip3 install --upgrade pip

$ python3 -m pip install --upgrade setuptools

# 最后再执行就可以了
$ pip3 install tensorflow==1.11.0

### 解决 ROS2 中 CMake 找不到 `libssl.so.1.1` 共享库的问题 在 Ubuntu 22.04 上遇到 `cmake: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory` 错误时,可以通过以下几种方式解决问题。 #### 方法一:安装特定版本的 OpenSSL 库 对于缺少 `libssl.so.1.1` 的情况,可以直接下载并安装对应版本的 `.deb` 文件: ```bash wget https://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.23_amd64.deb sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.23_amd64.deb ``` 这会将所需的 OpenSSL 版本安装到系统中[^2]。 #### 方法二:创建符号链接 如果已经安装了更高版本的 OpenSSL 而只是缺少旧版的符号链接,则可以尝试手动建立软连接来指向现有版本: ```bash find /usr/lib/x86_64-linux-gnu/ -name "libssl.so*" # 查找已有的 SSL 库文件路径 ln -s /usr/lib/x86_64-linux-gnu/libssl.so.3 /usr/lib/x86_64-linux-gnu/libssl.so.1.1 sudo ldconfig ``` 此操作假设当前存在更新版本的 `libssl.so` 并且其功能兼容于所需的老版本[^4]。 #### 方法三:通过包管理器安装依赖项 有时最简单的方法就是让系统的包管理系统自动处理这些依赖关系。确保所有必要的开发工具和库都已正确安装: ```bash sudo apt update && sudo apt upgrade sudo apt install ros-humble-desktop openssl cmake build-essential ``` 上述命令不仅解决了可能存在的 OpenSSL 库问题,还确保其他构建过程中需要用到的基础组件也处于最新状态[^3]。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值