### 基准测试安装错误,ModuleNotFoundError: 没有名为’main’的模块

为什么会出现这个错误?我无法再安装基准测试了。我需要导入包含在基准测试中的’get_data’。出了什么问题?

pip install benchmark

Collecting benchmark  Using cached benchmark-0.1.5.tar.gz (7.1 kB)    ERROR: Command errored out with exit status 1:     command: /opt/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/cf/gs10w86j2n1bf2_x86gmqscw0000gn/T/pip-install-qq5kp9hk/benchmark/setup.py'"'"'; __file__='"'"'/private/var/folders/cf/gs10w86j2n1bf2_x86gmqscw0000gn/T/pip-install-qq5kp9hk/benchmark/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/cf/gs10w86j2n1bf2_x86gmqscw0000gn/T/pip-pip-egg-info-_7t1tj64         cwd: /private/var/folders/cf/gs10w86j2n1bf2_x86gmqscw0000gn/T/pip-install-qq5kp9hk/benchmark/    Complete output (7 lines):    Traceback (most recent call last):      File "<string>", line 1, in <module>      File "/private/var/folders/cf/gs10w86j2n1bf2_x86gmqscw0000gn/T/pip-install-qq5kp9hk/benchmark/setup.py", line 3, in <module>        from benchmark import __VERSION__      File "/private/var/folders/cf/gs10w86j2n1bf2_x86gmqscw0000gn/T/pip-install-qq5kp9hk/benchmark/benchmark/__init__.py", line 10, in <module>        from main import BenchmarkProgram, main    ModuleNotFoundError: No module named 'main'    ----------------------------------------ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

回答:

benchmark 与 Python 版本 >= 3 不兼容。

你需要使用 Python 2。


在 Python 3 的虚拟环境中

~/workspace/so via 🐍 v3.8.5 via C python3 ❯ pip install benchmarkCollecting benchmark  Downloading benchmark-0.1.5.tar.gz (7.1 kB)    ERROR: Command errored out with exit status 1:     command: /home/louis/miniconda3/envs/python3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-wyj1c1sn/benchmark/setup.py'"'"'; __file__='"'"'/tmp/pip-install-wyj1c1sn/benchmark/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-0qo4nmp7         cwd: /tmp/pip-install-wyj1c1sn/benchmark/    Complete output (7 lines):    Traceback (most recent call last):      File "<string>", line 1, in <module>      File "/tmp/pip-install-wyj1c1sn/benchmark/setup.py", line 3, in <module>        from benchmark import __VERSION__      File "/tmp/pip-install-wyj1c1sn/benchmark/benchmark/__init__.py", line 10, in <module>        from main import BenchmarkProgram, main    ModuleNotFoundError: No module named 'main'    ----------------------------------------ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

使用 Python 2 :

~/workspace/so via 🐍 v2.7.18 :: Anaconda, Inc. via C python2 ❯ pip install benchmark           DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-supportCollecting benchmark  Using cached https://files.pythonhosted.org/packages/e9/af/e0390a38d8d8920a189775102d69fa19107c0b67f75c7934bc166e05d504/benchmark-0.1.5.tar.gzBuilding wheels for collected packages: benchmark  Building wheel for benchmark (setup.py) ... done  Created wheel for benchmark: filename=benchmark-0.1.5-cp27-none-any.whl size=6336 sha256=e4878032c29d27e51067deb70363bf7b7108fa93f9458befabfbbcce3b3d4598  Stored in directory: /home/louis/snap/codium/common/.cache/pip/wheels/a4/3f/24/d0ed8ae3351441f06a4a17a6ea3f5c500527144a9aebfbb05cSuccessfully built benchmarkInstalling collected packages: benchmarkSuccessfully installed benchmark-0.1.5

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注