简体   繁体   English

无法在Ubuntu上为pypy安装pip

[英]Failed to install pip for pypy on Ubuntu

I cannot install pip for pypy 4.0.1 on Ubuntu 15.10. 我无法在Ubuntu 15.10上为pypy 4.0.1安装pip。

I downloaded pypy 4.0.1 from http://pypy.org/download.html . 我从http://pypy.org/download.html下载了pypy 4.0.1。 Created a symlink for it. 为它创建了一个符号链接。 And used wget to download get-pip.py from https://bootstrap.pypa.io/get-pip.py . 并使用wget从https://bootstrap.pypa.io/get-pip.py下载get-pip.py。

But when I ran sudo pypy get-pip.py , I got exception: 但是当我运行sudo pypy get-pip.py ,我得到了异常:

Collecting pip
Exception:
Traceback (most recent call last):
    File "/tmp/tmps2kjCI/pip.zip/pip/basecommand.py", line 211, in main
      status = self.run(options, args)
    File "/tmp/tmps2kjCI/pip.zip/pip/commands/install.py", line 294, in run
      requirement_set.prepare_files(finder)
    File "/tmp/tmps2kjCI/pip.zip/pip/req/req_set.py", line 334, in prepare_files
      functools.partial(self._prepare_file, finder))
    File "/tmp/tmps2kjCI/pip.zip/pip/req/req_set.py", line 321, in _walk_req_to_install
      more_reqs = handler(req_to_install)
    File "/opt/pypy-4.0.1-linux64/lib_pypy/_functools.py", line 42, in __call__
      return self._func(*(self._args + fargs), **fkeywords)
    File "/tmp/tmps2kjCI/pip.zip/pip/req/req_set.py", line 491, in _prepare_file
      session=self.session)
    File "/tmp/tmps2kjCI/pip.zip/pip/download.py", line 825, in unpack_url
      session,
    File "/tmp/tmps2kjCI/pip.zip/pip/download.py", line 673, in unpack_http_url
      from_path, content_type = _download_http_url(link, session, temp_dir)
    File "/tmp/tmps2kjCI/pip.zip/pip/download.py", line 885, in _download_http_url
      with open(file_path, 'wb') as content_file:
    TypeError: expected string, got NoneType object

I could run sudo python get-pip.py without problem but failed with pypy. 我可以运行sudo python get-pip.py没有问题,但失败了pypy。 I also tried Ubuntu 12.04 and 14.04 but no luck. 我也尝试过Ubuntu 12.04和14.04,但没有运气。

I have Python 2.7.10 installed and I'm using a Linode machine. 我安装了Python 2.7.10,我正在使用Linode机器。 But changed to a DigitalOcean one didn't help. 但改成DigitalOcean并没有帮助。

How about installing PyPy from the Ubuntu archives sudo apt install pypy . 如何从Ubuntu档案sudo apt install pypy安装PyPy。 Or if you want the latest version, from the PyPy PPA 或者如果您想要最新版本,请使用PyPy PPA

Then if you create a virtualenv, it will have pip inside it: 然后,如果你创建一个virtualenv,它将在其中有pip:

$ sudo apt-get install virtualenv
$ virtualenv -p pypy ve
$ . ve/bin/activate
$ pip install ...

I had the same issue, and the solution is easy, yo have to run this command: 我有同样的问题,解决方案很简单,你必须运行这个命令:

export LC_ALL=C.UTF-8

And then run the pip installation. 然后运行pip安装。

You should add this line to your .bashrc or .bash_profile in the server, even you can add it to /etc/environment to have it in a global way. 您应该将此行添加到服务器中的.bashrc或.bash_profile,即使您可以将其添加到/ etc / environment以使其以全局方式使用。 (If someone has a better solution, please tell me) (如果有人有更好的解决方案,请告诉我)

Edit (2016-10): 编辑(2016-10):

Above is the global and lazy solution for any other distribution. 以上是任何其他发行版的全局和懒惰解决方案。 If you're in ubuntu, you need to reconfigure the locales and you can do it with: 如果你在ubuntu中,你需要重新配置语言环境,你可以这样做:

sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM