python - 在 debian/python 3.4 上安装 pip 包时出错

标签 python debian pip python-3.4

我在我的 debian 7.8 上从源代码编译了 python 3.4。 我已经使用 pipvirtualenv(django、pillow 等)安装了一些 Python 包,但是我在安装 python-phonenumbers 时出错(https://github.com/daviddrysdale/python-phonenumbers ). 我尝试使用 virtualenv 和不使用 virtualenv,运行 pip3 install phonenumbers 并手动下载存档并运行 python3 setup.py install。每次我遇到同样的错误时:

Command "/usr/local/bin/python3.4 -c "import setuptools, tokenize;
__file__='/tmp/pip-build-ogsbxm_d/phonenumbers/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__)
.read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record /tmp/pip-98gunm55-record/install-record.txt
--single-version-externally-managed --compile"
failed with error code -9 in /tmp/pip-build-ogsbxm_d/phonenumbers

我在我的 windows 和 ubuntu 14.04 上试过了 - 一切正常。我该如何解决?

最佳答案

对于 Ubuntu 14.04,来自 Docker 镜像 python:3.4.3-slim 这个组合对我有用:

sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y python3.4-dev
sudo apt-get install -y libpq-dev

pip3 install psycopg2

注意 build-essential 包。这对我来说至关重要。也许它也会对您有所帮助。

关于python - 在 debian/python 3.4 上安装 pip 包时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29189693/

相关文章:

python - 更新 Windows 上的 scrapy

python - 使用python填写网站文本框,点击按钮下载

python - 在单行代码中使用 *(扩展运算符)打印列表的列表

python - 使用 PIP 安装 pyside - 未找到 nmake

python - pip install 与 python3 -m pip install

python - 如何使用 TensorFlow 张量索引列表?

perl - 为用 perl 编写的应用程序构建 .deb 安装文件的常用工具是什么?

服务重启时的 php7 fpm sock 文件所有权

linux - 为 Windows 7 创建 Debian 镜像服务器

python - 错误 : No matching distribution found for pandas - "pip install pandas"