本文地址:http://www.04007.cn/article/506.html
昨天在执行安装https服务的时候遇到报错ImportError: No module named virtualenv本文地址:http://www.04007.cn/article/506.html,未经许可,不得转载.
[rootiZ282iltjiwZ https]# ./certbot-auto --nginx certonly
Creating virtual environment...
Traceback (most recent call last):
File "/usr/bin/virtualenv", line 2, in
import virtualenv
ImportError: No module named virtualenv
在看到上面的报错之后我执行安装本文地址:http://www.04007.cn/article/506.html,未经许可,不得转载.
[rootiZ282iltjiwZ https]# yum install virtualenv
Loaded plugins: security
Setting up Install Process
No package virtualenv available.
Error: Nothing to do
发现是包名不对后又更换包名执行安装yum install -y python-virtualenv发现这些都提示已经安装成功了如下本文地址:http://www.04007.cn/article/506.html,未经许可,不得转载.
[rootiZ282iltjiwZ https]# yum install python-virtualenv
Loaded plugins: security
Setting up Install Process
Package python-virtualenv-12.0.7-1.el6.noarch already installed and latest version
Nothing to do
可是却依然报错No module named virtualenv原来这是我已经升级过python2.6到2.7版本的原因yum安装的virtualenv使用的依然还是旧版本的python2.6而我当前的python用的是2.7所以会报错所以解决方法可以是以下两种方法之一本文地址:http://www.04007.cn/article/506.html,未经许可,不得转载.
1更换yum的python版本为2.7再进行安装。
2从官方下载virtualenv的tar文件包解压病利用新版本的python安装#python2.7 setup.py install。本文地址:http://www.04007.cn/article/506.html,未经许可,不得转载.
#解决方法如下, 成功安装virtualenv从而解决了问题。本文地址:http://www.04007.cn/article/506.html,未经许可,不得转载.
wget https://files.pythonhosted.org/packages/33/bc/fa0b5347139cd9564f0d44ebd2b147ac97c36b2403943dbee8a25fd74012/virtualenv-16.0.0.tar.gz
sudo tar zxvf virtualenv-16.0.0.tar.gz
cd virtualenv-16.0.0
python setup.py install
.....
#成功安装后的提示
Installed /usr/local/python27/lib/python2.7/site-packages/virtualenv-16.0.0-py2.7.egg
Processing dependencies for virtualenv16.0.0
Finished processing dependencies for virtualenv16.0.0
本文地址:http://www.04007.cn/article/506.html,未经许可,不得转载.
本文地址:http://www.04007.cn/article/506.html 未经许可,不得转载. 手机访问本页请扫描下方二维码