我刚刚完成了Linux Mint 17.3的全新安装。它配备了python 2.7和3.4。我通常使用python的多个版本,所以我只是做一个altinstall然后为每个项目我使用所需的python版本创建virtualenv。但是我遇到了新安装的操作系统的问题。首先介绍安装后我已经完成的一些事情:
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install python-virtualenv
sudo apt-get install python-pip
我做了一个python3.3.5:
downloaded the source tarball
./configure --with-zlib
sudo make
sudo make altinstall
然后我尝试在新文件夹中创建virtualenv进行测试:
virtualenv -p python3.3 venv
这给出了一个错误:
no module named zlib
我以前遇到过这个问题,所以我做了:
sudo apt-get install python-dev
sudo apt-get install zlib1g-dev
现在,当我创建virtualenv时,zlib错误消失了,但是我得到一个新的错误,我似乎无法弄清楚如何解决它:
Running virtualenv with interpreter /usr/local/bin/python3.3
Using base prefix '/usr/local'
New python executable in venv/bin/python3.3
Also creating executable in venv/bin/python
Installing setuptools, pip, wheel...
Complete output from command /home/vega/Documents...8/venv/bin/python3.3 -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/__init__.py", line 15, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/vcs/subversion.py", line 9, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/index.py", line 30, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/wheel.py", line 35, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/_vendor/distlib/scripts.py", line 14, in <module>
File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-7.1.2-py2.py3-none-any.whl/pip/_vendor/distlib/compat.py", line 66, in <module>
ImportError: cannot import name HTTPSHandler
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 2363, in <module>
main()
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 832, in main
symlink=options.symlink)
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1004, in create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 969, in install_wheel
'PIP_NO_INDEX': '1'
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 910, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/vega/Documents...8/venv/bin/python3.3 -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code 1
我在某处读到这可能与openssl有关,所以我做了:
sudo apt-get install openssl
sudo apt-get install libcurl4-openssl-dev
没有运气,仍然有同样的问题。
答案 0 :(得分:3)
我让其他人做这项工作,所以我不必担心自己从源头构建替代版本。
我使用Felix Krull&#34; deadsnakes&#34;真的好运。 PPA用于在Ubuntu上安装备用Pythons。这适用于Mint 17吗? (基于Ubuntu Trusty)
&#39; deadsnakes PPA&#39;软件包的版本:2.3,2.4,2.5,2.6,2.7,3.1,3.2,3.3,3.4,3.5 ......所有这些都可以从apt
安装。安装完成后,您可以使用virtualenv和pip来管理版本和依赖项。
从deadsnakes安装Python 3.5 PPA:
$ sudo add-apt-repository ppa:fkrull/deadsnakes
$ sudo apt-get update
$ sudo apt-get install python3.5 python3.5-dev
PPA维护者已经维护了很长时间并且每次更新Ubuntu都会更新。