如何在Heroku上修复ImportError“ _psutil_linux”

时间:2019-06-10 08:57:23

标签: python heroku psutil

我的代码中需要psutil,但在Heroku上出现错误“ importError _psutil_linux”

它是用于状态申请的系统使用情况以及免费使用的内容。

我已经尝试过:

- to force the installation with pip (not work)
- to change the version with the file requirements.txt (not work)

requirements.txt:

Unidecode==1.0.22
youtube_dl==2018.7.21
chardet==3.0.4
urlextract==0.8.3
feedparser==5.2.1
requests==2.18.4
setuptools==40.2.0
aiohttp==1.0.5
urllib3==1.22
discord.py==0.16.12
psutil==5.4.7
pip==9.0.3
pyparsing==2.2.0
Pillow==5.3.0
beautifulsoup4==4.6.3
httplib2==0.11.3
imgurpython==1.1.7
keyboard==0.13.2
google_api_python_client==1.7.4
pyfiglet==0.7.5
pylast==2.4.0
r6sapi==0.8.0
raven==6.9.0
raven_aiohttp==0.7.0
tabulate==0.8.2
typing==3.6.6

我对psutil的使用:

import psutil
CPU = psutil.cpu_percent()
RAM =psutil.virtual_memory().percent

(在不和谐的bot命令中。)

Traceback (most recent call last):
File "/app/cogs/owner.py", line 65, in load
self._load_cog(module)
File "/app/cogs/owner.py", line 946, in _load_cog
mod_obj = importlib.import_module(cogname)
File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/cogs/cyvgeneral.py", line 7, in <module>
import psutil
File "lib/psutil/__init__.py", line 100, in <module>
from . import _pslinux as _psplatform
File "lib/psutil/_pslinux.py", line 26, in <module>
from . import _psutil_linux as cext
ImportError: cannot import name '_psutil_linux'

我希望Psutil能够正确加载。

先谢谢您

0 个答案:

没有答案