我在这里找到了教程: https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-django-app/
我正在尝试创建一个Django项目并将其与Github和azure云平台同步。至于先决条件,除了用于Visual Studio的Python工具之外我都有,因为我使用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
提前致谢!
答案 0 :(得分:1)
我使用conda
重现了您的问题。似乎conda
将~/.bash_profile
配置为PYTHONPATH
。您可以尝试通过Python解释器中的以下代码检查PYTHONPATH
。
>>> 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
(不是全局的,不需要{{} 1}})。
要解决此问题,请尝试使用命令sudo
。