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
时间: 2023-06-30 10:19:34 浏览: 81
根据报错信息,看起来是 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
```
希望这些方法能够帮助您解决问题。
相关问题
File "setup.py", line 3, in <module> from setuptools import setup, find_packages ImportError: No module named setuptools
这个错误提示是因为你的环境缺少了 setuptools 模块。你需要先安装 setuptools。
如果你是在使用 Python 虚拟环境,可以尝试以下命令安装:
```
pip install setuptools
```
如果你没有使用虚拟环境,可能需要使用管理员权限运行上述命令。
如果你使用的是 Linux 或者 macOS 系统,可以尝试使用系统包管理器来安装 setuptools,例如:
```
sudo apt-get install python-setuptools # Debian/Ubuntu
sudo yum install python-setuptools # CentOS/RHEL
sudo brew install python-setuptools # macOS Homebrew
```
安装完成后,再次运行你的 setup.py 文件就应该没有问题了。
创建一个setup.py文件,例如: 复制 from setuptools import setup APP = ['your_script.py'] DATA_FILES = [] OPTIONS = {'argv_emulation': True} setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'], )详细点
好的,您想了解的是如何使用 setup.py 文件将 Python 脚本打包成 macOS 应用程序,对吗?
首先,我们需要使用 setuptools 库中的 setup 函数来创建 setup.py 文件。在 setup 函数中,我们需要指定应用程序的入口点和相关的数据文件。下面是一个示例 setup.py 文件的代码:
```python
from setuptools import setup
APP = ['your_script.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
```
在这个示例中,我们将应用程序的入口点指定为 `your_script.py`。如果您的应用程序有其他依赖项或数据文件,可以将它们添加到 DATA_FILES 列表中。OPTIONS 字典中的 `argv_emulation` 选项用于模拟命令行参数。
最后,我们将选项传递给 `py2app`,并将 `py2app` 添加到 `setup_requires` 列表中。这将告诉 setuptools 在运行 setup.py 文件之前安装 `py2app` 库。
运行 `python setup.py py2app` 命令即可将您的 Python 脚本打包成 macOS 应用程序。打包完成后,您可以在 `dist` 目录中找到生成的应用程序。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)