Python 3,Pip3和Sudo。 Sudo无法访问PIP安装的软件包
我试图弄清楚为什么我的sudo无法访问PIP安装的软件包。这是我以下设置的详细信息。
Ubuntu 20.04,新安装。带有Python3.8。 安装其他一些软件包,这些软件包安装了自己的Python(Intel MKL Oneapi),即Python3.9。此安装以某种方式使默认的python。我通过对python/python3和pip/pip3进行明确目标/usr/bin/python3(为3.8)来解决这个问题。
我做
pip安装包装
我使用python3
启动Python
,它正确地定位了别名/usr/usr/bin/python3
导入包装
没有问题。
在脚本中,我导入包装。如果我运行
python3设置。pyinstall
错误
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/test- easy-install-8015.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python3.8/dist-packages/
遇到
会因拒绝许可而
我
: >没有名为包装的模块,
所以我很好奇,为什么sudo
无法访问此软件包?
I'm trying to figure out why my sudo doesn't have access to pip installed packages. Here is the details of my setup below.
Ubuntu 20.04, Fresh install. Comes with Python3.8.
Install some other package, which installs its own Python (Intel MKL Oneapi), which is Python3.9. This install somehow makes that the default Python. I get around this by editting ~/.bashrc to explicitly target /usr/bin/python3 (which is 3.8) for python/python3 and pip/pip3 each.
I do
pip install packaging
I launch python with
python3
which correctly targets the alias'd /usr/bin/python3
and I am able to do import packaging
without issue.
In a script, I import packaging. If I run
python3 setup.py install
I get an error with a permission denied :
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/test- easy-install-8015.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python3.8/dist-packages/
`
So I then try
sudo python3 setup.py install
However I am now back to No module named packaging
SO I am curious, why does sudo
not have access to this package?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论