放轻松,我是n00b。当我尝试初始化环境以使项目进行时,出现此错误。在决定在此处发布之前,我已经遍历了很多堆栈溢出和GitHub(用法/请求)。我更新了pipenv,甚至通过python从3.6更新到3.7。我已经呆了两个小时,但我决定可能需要您的帮助。
pipenv run python3
Creating a virtualenv for this project…
Pipfile: /home/user1/Pipfile
Using /usr/bin/python3 (3.6.7) to create virtualenv…
⠙ Creating virtual environment...
✘ Failed creating virtual environment
[pipenv.exceptions.VirtualenvCreationException]: File "/home/user1/.local/lib/python3.6/site-packages/pipenv/cli/command.py", line 408, in run
[pipenv.exceptions.VirtualenvCreationException]: command=command, args=args, three=state.three, python=state.python, pypi_mirror=state.pypi_mirror
[pipenv.exceptions.VirtualenvCreationException]: File "/home/user1/.local/lib/python3.6/site-packages/pipenv/core.py", line 2310, in do_run
[pipenv.exceptions.VirtualenvCreationException]: three=three, python=python, validate=False, pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "/home/user1/.local/lib/python3.6/site-packages/pipenv/core.py", line 574, in ensure_project
[pipenv.exceptions.VirtualenvCreationException]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "/home/user1/.local/lib/python3.6/site-packages/pipenv/core.py", line 506, in ensure_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
[pipenv.exceptions.VirtualenvCreationException]: File "/home/user1/.local/lib/python3.6/site-packages/pipenv/core.py", line 935, in do_create_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: extra=[crayons.blue("{0}".format(c.err)),]
[pipenv.exceptions.VirtualenvCreationException]: Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/user1/.local/lib/python3.6/site-packages/virtualenv.py", line 26, in <module>
import logging
ImportError: bad magic number in 'logging': b'\x03\xf3\r\n'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 26, in <module>
from apt.package import Package
File "/usr/lib/python3/dist-packages/apt/package.py", line 24, in <module>
import logging
ImportError: bad magic number in 'logging': b'\x03\xf3\r\n'
Original exception was:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/user1/.local/lib/python3.6/site-packages/virtualenv.py", line 26, in <module>
import logging
ImportError: bad magic number in 'logging': b'\x03\xf3\r\n'
Failed to create virtual environ
ment。
答案 0 :(得分:0)
我认为独立版本已损坏,可以在现有的venv中为我工作
(test_123) conor@xxxxxxx:~/workspace/django-machina$ make init
pipenv install --three --dev
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Installing dependencies from Pipfile.lock (02d410)…
Ignoring appnope: markers 'sys_platform == "darwin"' don't match your environment
Looking in indexes: https://pypi.python.org/simple
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 75/75 — 00