python - 我无法在 ubuntu 中创建仅设置为 python3 的虚拟环境

标签 python linux ubuntu virtualenv

当我想使用 python3(更准确地说是 python3.6)创建虚拟环境时,即使我明确声明不这样做,它也会继续安装两个 python 版本。

我使用了命令:

virtualenv -p /usr/bin/python3.6 trydjango/

输出:

Running virtualenv with interpreter /usr/bin/python3.6
Already using interpreter /usr/bin/python3.6
Using base prefix '/usr'
New python executable in /home/oren/Dev/Python- 
Dev/trydjango/bin/python3.6
Also creating executable in /home/oren/Dev/Python- 
Dev/trydjango/bin/python
Installing setuptools, pip, wheel...
done.

当我查看 bin 目录时,我预计只安装了 python3.6,但这是输出:

activate       activate.ps1      easy_install      pip3    python3        
wheel
activate.csh   activate_this.py  easy_install-3.6  pip3.6  python3.6
activate.fish  activate.xsh      pip               python  python-config

最佳答案

我解决了问题,我同时使用了 pip install virtualenv 和 pip3 install virtualenv。我卸载了两者,只使用了 pip3 install virtualenv。所以现在只使用python3。

关于python - 我无法在 ubuntu 中创建仅设置为 python3 的虚拟环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58531063/

相关文章:

python在centos上更新到2.7.13

linux - 如何在特定索引处获取字符串的字符?

ubuntu - 在 ubuntu 14.04 中使用 gdb 时无法更改 tui 窗口大小

php - 未捕获的 PDOException : could not find driver inside docker container

python-serial OSError : [Errno 11] Resource temporarily unavailable

python - ValueError : Input 0 is incompatible with layer simple_rnn_1: expected ndim=3, 在 Keras 中发现 ndim=2

python - 将元组更改为小写 - 特定情况(Python;NLTK)

python - Jupyter 笔记本 : Importing SMOTE from imblearn - ImportError: cannot import name 'pairwise_distances_chunked'

linux - 从所有文件中提取 2 个值的 Shell 脚本?

c++ - C/C++ Windows 或 Linux 将随机内存块映射为连续顺序