(base) D:\work1\pycharmproject\ship-strain-measurement-system-main>python setup.py install Traceback (most recent call last): File "setup.py", line 18, in <module> setup(**config) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\__init__.py", line 106, in setup _install_setup_requires(attrs) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\__init__.py", line 74, in _install_setup_requires dist = MinimalDistribution(attrs) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\__init__.py", line 56, in __init__ super().__init__(filtered) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\dist.py", line 494, in __init__ for ep in metadata.entry_points(group='distutils.setup_keywords'): File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 856, in entry_points return EntryPoints(eps).select(**params) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 854, in <genexpr> dist.entry_points for dist in _unique(distributions()) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\_itertools.py", line 16, in unique_everseen k = key(element) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\_py39compat.py", line 18, in normalized_name return dist._normalized_name File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 778, in _normalized_name or super()._normalized_name File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 445, in _normalized_name return Prepared.normalize(self.name) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 700, in normalize return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_') File "D:\software\anaconda\anaconda3\lib\re.py", line 192, in sub return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object
时间: 2023-06-30 07:19:08 浏览: 199
根据你提供的错误信息,看起来是在运行 Python 的 setup.py 文件时出现了错误。错误信息显示了一个 TypeError,提示了一个期望字符串或 bytes-like 对象的错误。可能是在代码中将一个非字符串或非 bytes-like 对象传递给了一个需要这些对象的函数或方法。你可以检查代码,确认是否存在这样的问题。
相关问题
from setuptools import setup config = { 'name': 'ssms', 'version': '0.1', 'author': 'Noah Davis', 'packages': ['ssms'], 'package_dir': {'': 'src/main/python'}, 'author_email': 'noahdavis@gwu.edu', 'description': 'Perform strain measurements using computer vision.', 'entry_points': { 'console_scripts': ['ssms=ssms.cli:cli'] } } setup(**config)报错D:\software\anaconda\anaconda3\python.exe D:/work1/pycharmproject/ship-strain-measurement-system-main/setup.py Traceback (most recent call last): File "D:/work1/pycharmproject/ship-strain-measurement-system-main/setup.py", line 18, in <module> setup(**config) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\__init__.py", line 106, in setup _install_setup_requires(attrs) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\__init__.py", line 74, in _install_setup_requires dist = MinimalDistribution(attrs) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\__init__.py", line 56, in __init__ super().__init__(filtered) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\dist.py", line 494, in __init__ for ep in metadata.entry_points(group='distutils.setup_keywords'): File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 856, in entry_points return EntryPoints(eps).select(**params) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 854, in <genexpr> dist.entry_points for dist in _unique(distributions()) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\_itertools.py", line 16, in unique_everseen k = key(element) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\_py39compat.py", line 18, in normalized_name return dist._normalized_name File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 778, in _normalized_name or super()._normalized_name File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 445, in _normalized_name return Prepared.normalize(self.name) File "D:\software\anaconda\anaconda3\lib\site-packages\setuptools\_vendor\importlib_metadata\__init__.py", line 700, in normalize return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_') File "D:\software\anaconda\anaconda3\lib\re.py", line 192, in sub return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object Process finished with exit code 1
根据报错信息,看起来是 setuptools 的一个 bug 导致的问题。您可以尝试升级 setuptools 到最新版本来解决该问题。
您可以使用以下命令升级 setuptools:
```
pip install --upgrade setuptools
```
如果升级 setuptools 后问题仍然存在,请尝试清除 setuptools 缓存并重新安装它:
```
pip install --upgrade --no-cache-dir setuptools
```
如果以上方法还不能解决问题,您可以尝试升级 pip 到最新版本。您可以使用以下命令来升级 pip:
```
pip install --upgrade pip
```
然后再尝试重新安装 setuptools:
```
pip install setuptools
```
希望这些方法能够帮助您解决问题。
Traceback (most recent call last): File "D:\pythonProject\main.py", line 43, in <module> for i in range(strainZX.shape[0]): AttributeError: 'dvector' object has no attribute 'shape'
这个错误提示表示在`strainZX`这个`dvector`对象上无法使用`shape`属性,因为`dvector`对象并没有`shape`属性。
`dvector`是LS-DYNA Python接口中的一种数据类型,它表示一个包含双精度浮点数的向量。如果要获取`dvector`对象中的数据个数,可以使用`size()`方法。因此,你可以使用以下代码将`strainZX`中的每一个值打印出来:
```python
strainZX = br.get_data(bdt.BINOUT_ELOUT_STRAIN_ZX, idtype=bit.BINOUT_ELOUT_ID_SHELL, id=100, datatype_option=bdto.BINOUT_DATATYPE_ELOUT_LOWER)
n_steps = strainZX.size() // num_integration_points
for i in range(n_steps):
for j in range(num_integration_points):
print("Time step: {}, Integration point: {}, Value: {}".format(i+1, j+1, strainZX[i * num_integration_points + j]))
```
其中,`num_integration_points`表示该壳单元的积分点数。`strainZX.size()`方法返回`dvector`对象中包含的浮点数个数,因此可以通过`strainZX.size() // num_integration_points`计算出时间步数,进而遍历所有的时间步和积分点,将每一个值打印出来。
阅读全文