为什么 python setup.py bdist_wheel 编译 wheel 会影响其他的包?
首先我用 sa 用户登录到一台 arm linux 上
然后
mkdir ~/pypicd ~/pypi
wget https://files.pythonhosted.org/packages/cf/01/e8a380dc6e92a76113f034c58c9ffdbd115753e9b944ddf5d2dbe862f248/pydantic-1.10.11.tar.gz
tar -xvzf ./pydantic-1.10.11.tar.gz
cd pydantic-1.10.11/
sudo yum install -y gcc make cmake python3-devel
准备好了一切工作,最后
python3 setup.py bdist_wheel
结果报错了
[sa@adv-node pydantic-1.10.11]$ python3 setup.py bdist_wheelTraceback (most recent call last):
File "setup.py", line 7, in <module>
from setuptools import setup
File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 14, in <module>
import setuptools.version
File "/usr/lib/python3.7/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3112, in <module>
@_call_aside
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3096, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3125, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 569, in _build_master
ws = cls()
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 562, in __init__
self.add_entry(entry)
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 618, in add_entry
for dist in find_distributions(entry, True):
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1965, in find_on_path
for dist in factory(fullpath):
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2027, in distributions_from_metadata
if len(os.listdir(path)) == 0:
PermissionError: [Errno 13] Permission denied: '/usr/local/lib64/python3.7/site-packages/torchvision-0.14.1.dist-info'
我不理解,我在 /home/sa/pypi/pydantic-1.10.11
下面执行 python3 setup.py bdist_wheel
关系统路径什么事情?关这个 torchvision 什么事情?
回答:
看报错时访问了没权限的目录报的错,改一下权限:
sudo chmod -R o+r /usr/local/lib64/python3.7/site-packages/torchvision-0.14.1.dist-info
或者用虚拟环境:
python3 -m venv myenvsource myenv/bin/activate
cd ~/pypi/pydantic-1.10.11/
python setup.py bdist_wheel
以上是 为什么 python setup.py bdist_wheel 编译 wheel 会影响其他的包? 的全部内容, 来源链接: utcz.com/p/939005.html