python - 将 Python3 传递给 virtualenvwrapper 会抛出 ImportError

标签 python ubuntu python-3.x virtualenvwrapper

我正在尝试使用 virtualenvwrapper 制作基于 python 3 的 virtualenv。但是,当我传递可选的解释器参数时,我看到了这个错误。我正在运行 Ubuntu 15.04。我尝试重新安装 virtualenvvirtualenvwrapper 但没有成功。感谢您的帮助!

$ 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.

最佳答案

我遇到了同样的问题,但是在我将 virtualenv 降级到 12.0.2 之后,这个问题就消失了。

关于python - 将 Python3 传递给 virtualenvwrapper 会抛出 ImportError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32861935/

相关文章:

python - 如何用 None 替换字符串值 - python,pandas dataframe

Python帮助更新Postgres专栏

python - 语法在客户转换器上提取日,月,年的语法错误

python-3.x - 如何将多个 python 脚本一起部署为多个 aws lambda 函数?

python-3.x - zappa 可以用来直接运行函数吗(非 wsgi 应用程序)

python - 在 Python 中,如何从包含多个类的文件中导入一个类?

Python 多处理在绘图期间挂起

linux - 在 Unix/Linux 中提取 Jar 的最佳方法?

ubuntu - 作为外部进程启动时,Unix 脚本命令不捕获标准输入

linux - 使用 CONFIG_DEBUG_LOCK_ALLOC 构建内核时 ZFS 中的许可问题