sudo pip3 install chardet-5.1.0.tar.gz [sudo] password for ubuntu: The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Processing ./chardet-5.1.0.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python3.6/tokenize.py", line 452, in open buffer = _builtin_open(filename, 'rb') FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-l64mmjzv-build/setup.py' ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-l64mmjzv-build/
时间: 2024-03-29 20:35:13 浏览: 160
pip-21.3.1.tar.gz
这个错误提示显示找不到 `/tmp/pip-l64mmjzv-build/setup.py` 这个文件。这可能是由于缺少依赖项或网络问题导致的。你可以尝试以下解决方法:
1. 确认是否已经安装了 `setuptools` 和 `wheel` 这两个依赖项,如果没有,请先安装:
```
sudo pip3 install setuptools wheel
```
2. 检查你的网络连接是否正常,可以尝试使用 `ping` 命令测试一下:
```
ping www.google.com
```
如果无法连接,可能需要检查你的网络设置。
3. 如果以上两个方法都没能解决问题,可以尝试清除 pip 的缓存,并重新安装:
```
sudo pip3 cache purge
sudo pip3 install chardet-5.1.0.tar.gz
```
希望这些方法能帮助你解决问题。另外,建议在使用 `sudo pip` 安装包时加上 `-H` 参数,以避免出现权限问题:
```
sudo -H pip3 install package_name
```
阅读全文