gpt4 book ai didi

python - 在 Mac 上的 Azure 云平台中设置 Django 时出现 Virtualenv 错误

转载 作者:太空宇宙 更新时间:2023-11-03 16:59:06 26 4
gpt4 key购买 nike

我在这里找到了教程: https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-django-app/

我正在尝试创建一个 Django 项目并将其与 Github 和 azure 云平台同步。至于先决条件,除了 Visual Studio 的 Python Tools 之外,我拥有一切,因为我使用 PyCharm 进行开发。

我按照教程所示克隆了存储库,但是当我尝试创建虚拟环境时

$ python -m virtualenv env

我收到以下回复:

New python executable in env/bin/python
Installing setuptools, pip, wheel...
Complete output from command /Users/dimitris/JBring/env/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/dimitris/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-7.0.1-py2.py3-none-any.whl/pip/__init__.py", line 13, in <module>
File "/Users/dimitris/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-7.0.1-py2.py3-none-any.whl/pip/utils/__init__.py", line 15, in <module>
File "/Users/dimitris/anaconda/lib/python2.7/zipfile.py", line 6, in <module>
import io
File "/Users/dimitris/anaconda/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/Users/dimitris/JBring/env/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /Users/dimitris/JBring/env/lib/python2.7/lib-dynload/_io.so
Expected in: dynamic lookup

----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/Users/dimitris/anaconda/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/Users/dimitris/anaconda/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Users/dimitris/anaconda/lib/python2.7/site-packages/virtualenv.py", line 2363, in <module>
main()
File "/Users/dimitris/anaconda/lib/python2.7/site-packages/virtualenv.py", line 832, in main
symlink=options.symlink)
File "/Users/dimitris/anaconda/lib/python2.7/site-packages/virtualenv.py", line 1004, in create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/Users/dimitris/anaconda/lib/python2.7/site-packages/virtualenv.py", line 969, in install_wheel
'PIP_NO_INDEX': '1'
File "/Users/dimitris/anaconda/lib/python2.7/site-packages/virtualenv.py", line 910, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/dimitris/JBring/env/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code 1

我使用的是与 anaconda 包一起安装的 Python 2.7。我使用以下命令安装了 virtualenv:

conda install virtualenv

提前致谢!

最佳答案

我使用 conda 重现了您的问题。看来conda配置了~/.bash_profile搞砸PYTHONPATH 。您可以尝试查看PYTHONPATH通过 Python 解释器中的以下代码。

>>> import sys
>>> sys.path

操作系统在路径/usr/local/lib/python2.7/site-packages安装的默认Python包& /Library/Python/2.7/site-packages ,但是conda在路径~/anaconda/lib/python2.7/site-package安装了python包并配置了~/.bash_profile设置本地 PYTHONPATH (不是全局的,不需要 sudo )。

要解决此问题,请尝试使用命令 virtual env --no-setuptools --no-pip --no-wheel .

关于python - 在 Mac 上的 Azure 云平台中设置 Django 时出现 Virtualenv 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35153565/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com