我已经愉快地使用了pipenv几个月了,但是今天我坏了一些东西,无法解决。当我尝试让line_profiler
工作时,一切就开始了。 It doesn't work with pip at the moment,所以我尝试按照自述文件中的说明进行操作。因此,此操作无效,因为我无法弄清楚如何从cython
安装brew
。
症状
如果我创建一个新目录,并执行一个简单的命令,例如pipenv install pandas
,那么一切正常,那么我将得到一个Pipfile
,如下所示:
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
pandas = "*"
[requires]
python_version = "3.7"
如果我随后将此Pipfile复制到新目录并尝试使用pipenv install
在其中创建虚拟环境,它将失败,并显示以下消息:
✘ Failed creating virtual environment
[pipenv.exceptions.VirtualenvCreationException]: File "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/site-packages/pipenv/cli/command.py", line 254, in install
[pipenv.exceptions.VirtualenvCreationException]: editable_packages=state.installstate.editables,
[pipenv.exceptions.VirtualenvCreationException]: File "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/site-packages/pipenv/core.py", line 1741, in do_install
[pipenv.exceptions.VirtualenvCreationException]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/site-packages/pipenv/core.py", line 574, in ensure_project
[pipenv.exceptions.VirtualenvCreationException]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/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 "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/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/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/site-packages/virtualenv.py", line 2502, in <module>
main()
File "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/site-packages/virtualenv.py", line 793, in main
symlink=options.symlink,
File "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/site-packages/virtualenv.py", line 1070, in create_environment
install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
File "/usr/local/Cellar/pipenv/2018.11.26_2/libexec/lib/python3.7/site-packages/virtualenv.py", line 1487, in install_python
shutil.copy(original_python, py_executable)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/shutil.py", line 245, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/shutil.py", line 103, in copyfile
if _samefile(src, dst):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/shutil.py", line 88, in _samefile
return os.path.samefile(src, dst)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/genericpath.py", line 96, in samefile
s1 = os.stat(f1)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
Failed to create virtual environment.
如果我转到以前工作的目录之一,然后尝试pipenv run jupyter notebook
,则会收到如下错误:
pipenv run jupyter notebook
Traceback (most recent call last):
File "/Users/robertking/.local/share/virtualenvs/decision_quality-DM1iI0uH/bin/jupyter-notebook", line 6, in <module>
from notebook.notebookapp import main
File "/Users/robertking/.local/share/virtualenvs/decision_quality-DM1iI0uH/lib/python3.6/site-packages/notebook/notebookapp.py", line 62, in <module>
from tornado import httpserver
File "/Users/robertking/.local/share/virtualenvs/decision_quality-DM1iI0uH/lib/python3.6/site-packages/tornado/httpserver.py", line 29, in <module>
import ssl
File "/Users/robertking/.pyenv/versions/3.6.8/lib/python3.6/ssl.py", line 101, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: dlopen(/Users/robertking/.local/share/virtualenvs/decision_quality-DM1iI0uH/lib/python3.6/lib-dynload/_ssl.cpython-36m-darwin.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /Users/robertking/.local/share/virtualenvs/decision_quality-DM1iI0uH/lib/python3.6/lib-dynload/_ssl.cpython-36m-darwin.so
Reason: image not found
我尝试卸载并重新安装pipenv,以及常见的技巧pipenv --rm
和删除缓存~/Library/Caches/pipenv
您知道我还能检查什么,或者可能会发生什么?
答案 0 :(得分:0)
我现在又重新开始工作了。我承认这不是一个很好的答案,但它可能会对某人有所帮助。我不确定过程的哪一部分是关键的,什么是偶然的:
pip
。这导致我重新安装了使用pyenv
安装的Python版本。 pip
然后开始工作。pipenv
版本,并使用pip install
重新安装了它。所以基本上,重新安装我所有的python工具似乎可以解决问题。