Ubuntu pip list 包在list里,无法import

在Ubuntu系统中安装TensorRT后,尽管pip列表显示已成功安装,但在Python环境中尝试import时失败。首先怀疑是环境变量问题,调整无果,然后经同事提示,通过使用`sudochmod777XXX`命令赋予文件夹全权限,最终解决了导入失败的问题。
摘要由CSDN通过智能技术生成

说一下Ubuntu  安装TensorRt辛酸历程,一路跟着教程来的,最后pip list已经包含了tensorrt,但是在python里import失败,本以为是环境变量的原因,改了也不行,同事提醒提升文件夹权限,完了就ok了。

命令是下边这个

sudo chmod 777 ××× (每个人都有读和写以及执行的权限)

Ubuntu上安装numpy和pip的步骤如下: 1. 首先,检查是否已经安装了pip。在终端下输入命令`pip --version`来检查pip的版本。如果没有安装pip,可以使用以下命令从标准库中导入pip:`python -m ensurepip --default-pip`。\[1\] 2. 虽然pip的版本可能显示为8.1.1,但实际上已经安装了18.1版本。然而,为了避免出现错误,我们需要配置pip3。如果出现类似于`ImportError: cannot import name 'main'`的错误,请按照以下步骤进行配置:\[2\] - 配置pip3:`sudo apt-get install python3-pip` - 更新pip3:`pip3 install --upgrade pip` 3. 如果你在安装numpy时遇到了openssl模块的问题,可以按照以下步骤进行修复:\[3\] - 安装openssl模块:`sudo apt-get install openssl` - 安装libssl-dev:`sudo apt-get install libssl-dev` - 修改Modules/Setup文件:使用vim编辑器打开文件`vim Modules/Setup`,找到以下内容并删除前面的#号: ``` # Socket module helper for socket(2) _socket socketmodule.c timemodule.c # Socket module helper for SSL support; you must comment out the other # socket line above, and possibly edit the SSL variable: #SSL=/usr/local/ssl _ssl _ssl.c \ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ -L$(SSL)/lib -lssl -lcrypto ``` - 重新安装Python:在Python解压目录下执行以下命令: ``` ./configure --prefix=/usr/local/python make make install ``` 这样,你就可以在Ubuntu上成功安装numpy和pip了。 #### 引用[.reference_title] - *1* *3* [ubuntu系统下安装pip,利用pip安装numpy](https://blog.csdn.net/zeqiongyang/article/details/80135056)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Ubuntu安装配置pip3及numpy库](https://blog.csdn.net/zengkunliu/article/details/125339704)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值