在Ubuntu16.4上安装虚拟环境失败

时间:2020-01-16 00:42:27

标签: python

我正在尝试在Ubuntu上安装虚拟环境,而我的python是3.5。我的命令是:

python3 -m venv my-env/ 

这提醒我先安装python3-venv,但随后出现以下错误。

apt-get install python3-venv
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-venv is already the newest version (3.5.1-3).
0 upgraded, 0 newly installed, 0 to remove and 95 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Setting up cython3 (0.23.4-0ubuntu5) ...
Traceback (most recent call last):
  File "/usr/bin/py3compile", line 34, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
ImportError: No module named 'debpython'
dpkg: error processing package cython3 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 cython3
E: Sub-process /usr/bin/dpkg returned an error code (1)

这是因为Python3.5不适用于python3 -m venv吗?如果我无法升级python3.5,该怎么办?

1 个答案:

答案 0 :(得分:0)

  1. 在没有root / sudo的情况下,您不能使用apt-get install。是的,您可以jump through hoops,但可以忽略它。
  2. 可以使用不带root用户的anaconda-python。那将是与系统版本不同的独立python。这是另一个问题的主题
  3. 您的语言环境混乱
  4. 是的,错误消息可能会更好

稍后添加

为什么内置python中不存在venv?应该是to be there 3.3 onwards

Pip是apt的替代选择,默认情况下对用户有效—不需要sudo。 您可以手动get pip,但是这很奇怪而且不明智

但是即使 command 不可用,pip module 也应该可以工作,即使用 python3 -m pip仅在pip使用的地方