相关疑难解决方法(0)

为什么Python中的"pip install"引发了一个SyntaxError?

我正在尝试使用pip来安装软件包.我尝试pip install从Python shell 运行,但我得到了一个SyntaxError.为什么我会收到此错误?我如何使用pip来安装包?

>>> pip install selenium
              ^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)

python install pip

203
推荐指数
5
解决办法
48万
查看次数

找不到满足要求<package>的版本

我正在使用以下requirements.txt文件在Ubuntu 12.04中安装几个Python包:

numpy>=1.8.2,<2.0.0
matplotlib>=1.3.1,<2.0.0
scipy>=0.14.0,<1.0.0
astroML>=0.2,<1.0
scikit-learn>=0.14.1,<1.0.0
rpy2>=2.4.3,<3.0.0
Run Code Online (Sandbox Code Playgroud)

和这两个命令:

$ pip install --download=/tmp -r requirements.txt
$ pip install --user --no-index --find-links=/tmp -r requirements.txt
Run Code Online (Sandbox Code Playgroud)

(第一个下载包,第二个安装它们).

该过程经常因错误而停止:

  Could not find a version that satisfies the requirement <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2)) (from versions: )
No matching distribution found for <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2))
Run Code Online (Sandbox Code Playgroud)

我手动修复:

pip install --user <package>
Run Code Online (Sandbox Code Playgroud)

然后pip install再次运行第二个命令.

但是,这仅适用于特定的包.当我pip install再次运行第二个命令时,进程停止现在抱怨另一个必需的包,我需要再次重复该过程,即:手动安装新的所需包(使用上面的命令),然后运行第二个pip install命令.

到目前为止,我不得不手动安装six,pytz …

python pip requirements.txt

113
推荐指数
7
解决办法
55万
查看次数

点"无法找到满足要求的"

当我尝试安装PyGame时:pip install pygame它说

收集pygame

找不到满足要求pygame的版本(来自版本:)
没有找到匹配的分发

我相信我使用的是最新版本8.1.1.我在Windows 8.1上使用Python 3.5.1.我已经看过这个问题的其他答案,但没有一个对我有用.谢谢你的帮助.

python pip

18
推荐指数
1
解决办法
15万
查看次数

Python 3.5.1:NameError:未定义名称'json'

#!/usr/bin/env python
# encoding: utf-8

import tweepy #https://github.com/tweepy/tweepy
import json as simplejson


    #write tweet objects to JSON
    file = open('tweet.json', 'wb') 
    print ("Writing tweet objects to JSON please wait...")
    for status in alltweets:
        json.dump(status._json,file,sort_keys = True,indent = 4)

    #close the file
    print ("Done")
    file.close()

if __name__ == '__main__':
    #pass in the username of the account you want to download
    get_all_tweets("@AlertZaAfrica")
Run Code Online (Sandbox Code Playgroud)

python编译器说第54行是错误的.我已经将import json定义为simplejson.上面我定义了导入json的区域如上所示.

python python-3.5

7
推荐指数
1
解决办法
2万
查看次数

标签 统计

python ×4

pip ×3

install ×1

python-3.5 ×1

requirements.txt ×1