man*_*anu 6 python ubuntu virtualenvwrapper python-3.x
我正在尝试使用virtualenvwrapper
基于python 3的方法virtualenv
.但是,当我传递可选的解释器参数时,我看到了这个错误.我正在运行Ubuntu 15.04.我尝试重新安装virtualenv
,virtualenvwrapper
但没有成功.感谢你的帮助!
$ mkvirtualenv scriptcutter --python=/usr/bin/python3
Running virtualenv with interpreter /usr/bin/python3
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 8, in <module>
import base64
File "/usr/lib/python3.4/base64.py", line 9, in <module>
import re
File "/usr/lib/python3.4/re.py", line 336, in <module>
import copyreg
File "/usr/local/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 53, in apport_excepthook
if not enabled():
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 24, in enabled
import re
File "/usr/lib/python3.4/re.py", line 336, in <module>
import copyreg
File "/usr/local/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
Original exception was:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 8, in <module>
import base64
File "/usr/lib/python3.4/base64.py", line 9, in <module>
import re
File "/usr/lib/python3.4/re.py", line 336, in <module>
import copyreg
File "/usr/local/lib/python2.7/dist-packages/copyreg/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
Run Code Online (Sandbox Code Playgroud)
这是目前的一种解决方法。
创建一个virtualenv
使用pyvenv
.
# install pyvenv on Ubuntu
sudo apt-get install python3-venv
Run Code Online (Sandbox Code Playgroud)
为了最大限度地减少对正常工作流程的干扰,请传递与使用的目标目录相同的目标目录,virtualenvwrapper
如下所示,
pyvenv example ~/.virtualenvs/example
这会自动使用workon
和cdproject
命令。我没有使用太多其他提供的virtualenvwrapper
希望这可以帮助。
归档时间: |
|
查看次数: |
1618 次 |
最近记录: |