virtualenv使用Python3在Ubuntu 16.04上发布

时间:2018-02-06 09:20:21

标签: python python-3.x ubuntu virtualenv virtualenvwrapper

我正在尝试使用virtualenvwrapper在我的Ubuntu 16.04开发机器上为python3.5.x设置virtualenv。我安装了以下内容:

sudo -H python3 get-pip.py
sudo -H pip install virtualenv virtualenvwrapper

以下是事态:

$ which python
/usr/bin/python
$ which python3
/usr/bin/python3
$ python --version
Python 2.7.12
$ python3 --version
Python 3.5.2
$ pip --version
pip 9.0.1 from /usr/local/lib/python3.5/dist-packages (python 3.5)
$ pip3 --version
pip 9.0.1 from /usr/local/lib/python3.5/dist-packages (python 3.5)
$ md5sum `which pip`
b1d4013513817094e7cf0779f0963c87  /usr/local/bin/pip
$ md5sum `which pip3`
b1d4013513817094e7cf0779f0963c87  /usr/local/bin/pip3

我的〜/ .bash_profile中包含以下内容:

VIRTUALENVWRAPPER_PYTHON=python3
export WORKON_HOME=$HOME/.venvs
export PROJECT_HOME=$HOME/code
source /usr/local/bin/virtualenvwrapper.sh

但是当我去运行时,我得到以下内容:

$ source ~/.bash_profile
$ mkvirtualenv just_testing
Using base prefix '/usr'
New python executable in /home/me/.venvs/just_testing/bin/python3
Also creating executable in /home/me/.venvs/just_testing/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /home/me/.venvs/just_testing/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/me/.venvs/just_testing/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/me/.venvs/just_testing/bin/preactivate
virtualenvwrapper.user_scripts creating /home/me/.venvs/just_testing/bin/postactivate
virtualenvwrapper.user_scripts creating /home/me/.venvs/just_testing/bin/get_env_details
/home/me/.venvs/just_testing/bin/python3: Error while finding spec for 'virtualenvwrapper.hook_loader' (ImportError: No module named 'virtualenvwrapper')
/home/me/.venvs/just_testing/bin/python3: Error while finding spec for 'virtualenvwrapper.hook_loader' (ImportError: No module named 'virtualenvwrapper')
$ pip install numpy 
Collecting numpy
  Using cached numpy-1.14.0-cp35-cp35m-manylinux1_x86_64.whl
Installing collected packages: numpy
Successfully installed numpy-1.14.0
(just_testing) $ which python
/home/me/.venvs/just_testing/bin/python
(just_testing) $ python
>>> import numpy as np  # works fine!?
>>> exit()
(just_testing) $ deactivate
/home/me/.venvs/just_testing/bin/python3: Error while finding spec for 'virtualenvwrapper.hook_loader' (ImportError: No module named 'virtualenvwrapper')
$ 

我一直遇到同样的Error while finding spec for 'virtualenvwrapper.hook_loader' (ImportError: No module named 'virtualenvwrapper')错误,但是我的virtualenv似乎是有用的。

有什么想法在这里发生了什么?

0 个答案:

没有答案