Python 中的冲突库错误
Conflicting libraries error in Python
我正在尝试安装一个库 运行 它在 PyCharm 上。试图通过 PyCharm 安装它,但我不能,发生了一些错误:
Collecting Google-Search-API
Using cached Google-Search-API-1.1.13.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/5t/y8w_0_2j52l866cgl2p2q0nm0000gn/T/pycharm-packaging0.tmp/Google-Search-API/setup.py", line 15, in <module>
with open("test_requirements.txt") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'test_requirements.txt'
连同错误信息还有一个建议:
"Try to run this command from the system terminal. Make sure that you
use the correct version of 'pip' installed for your Python interpreter
located at
'/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5'."
酷。所以我去了终端,做了一个 export PATH=/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5:$PATH
以确保 pip 将 lib 发送到正确的位置。
尝试pip install Google-Search-API
后,一切似乎都还好:
MacBook-Air-2:~ santanna_santanna$ pip install Google-Search-API
Requirement already satisfied: Google-Search-API in /anaconda/lib/python2.7/site-packages
没有错误,很酷。
所以我回到 PyCharm 并按照 [Google-Search-API GitHub][1] 中的建议输入:
import google
得到:
ImportError: No module named 'google'
我绞尽脑汁安装它并在 PyCharm 上使用。
注意:在终端上执行 export PATH=...
后,我执行了 which python
,终端给我的答案是 //anaconda/bin/python
编辑
尝试了 sudo /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 -m pip install Google-Search-API
,我得到的错误与 PyCharm 上的错误非常相似:
The directory '/Users/santanna_santanna/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/santanna_santanna/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting Google-Search-API
Downloading Google-Search-API-1.1.13.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-build-j2qk3_00/Google-Search-API/setup.py", line 15, in <module>
with open("test_requirements.txt") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'test_requirements.txt'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-j2qk3_00/Google-Search-API/
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
此包处于 alpha 状态,仅支持 Python 2,根据其 PyPI 页面:https://pypi.python.org/pypi/Google-Search-API。这可能是它安装错误的原因。
我建议使用替代解决方案来查询 Google 搜索 API,或者如果您绝对必须使用此包,则切换到 Python 2。
也许你换了另一种可能,但对于其他想在python3
发展的人
安装包
unidecode (py -3.5 -m pip install unidecode)
selenium (py -3.5 -m pip install selenium)
bs4 (py -3.5 -m pip install bs4)
然后插入以下命令(确保您已安装 git)
py -3.5 -m pip install git+https://github.com/abenassi/Google-Search-API/
命令:
py -3.5 -m pip
对于 python 3.5 版,如果您处理多个 python 版本,这是一种舒适的方法,因此它将从 python 3.5 目录
调用 pip
它是从 github 存储库下载的,在这种情况下我对丢失的 .txt 文件没有任何问题并且非常适合我
我正在尝试安装一个库 运行 它在 PyCharm 上。试图通过 PyCharm 安装它,但我不能,发生了一些错误:
Collecting Google-Search-API
Using cached Google-Search-API-1.1.13.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/5t/y8w_0_2j52l866cgl2p2q0nm0000gn/T/pycharm-packaging0.tmp/Google-Search-API/setup.py", line 15, in <module>
with open("test_requirements.txt") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'test_requirements.txt'
连同错误信息还有一个建议:
"Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at '/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5'."
酷。所以我去了终端,做了一个 export PATH=/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5:$PATH
以确保 pip 将 lib 发送到正确的位置。
尝试pip install Google-Search-API
后,一切似乎都还好:
MacBook-Air-2:~ santanna_santanna$ pip install Google-Search-API
Requirement already satisfied: Google-Search-API in /anaconda/lib/python2.7/site-packages
没有错误,很酷。
所以我回到 PyCharm 并按照 [Google-Search-API GitHub][1] 中的建议输入:
import google
得到:
ImportError: No module named 'google'
我绞尽脑汁安装它并在 PyCharm 上使用。
注意:在终端上执行 export PATH=...
后,我执行了 which python
,终端给我的答案是 //anaconda/bin/python
编辑
尝试了 sudo /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 -m pip install Google-Search-API
,我得到的错误与 PyCharm 上的错误非常相似:
The directory '/Users/santanna_santanna/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/santanna_santanna/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting Google-Search-API
Downloading Google-Search-API-1.1.13.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-build-j2qk3_00/Google-Search-API/setup.py", line 15, in <module>
with open("test_requirements.txt") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'test_requirements.txt'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-j2qk3_00/Google-Search-API/
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
此包处于 alpha 状态,仅支持 Python 2,根据其 PyPI 页面:https://pypi.python.org/pypi/Google-Search-API。这可能是它安装错误的原因。
我建议使用替代解决方案来查询 Google 搜索 API,或者如果您绝对必须使用此包,则切换到 Python 2。
也许你换了另一种可能,但对于其他想在python3
发展的人安装包
unidecode (py -3.5 -m pip install unidecode)
selenium (py -3.5 -m pip install selenium)
bs4 (py -3.5 -m pip install bs4)
然后插入以下命令(确保您已安装 git)
py -3.5 -m pip install git+https://github.com/abenassi/Google-Search-API/
命令:
py -3.5 -m pip
对于 python 3.5 版,如果您处理多个 python 版本,这是一种舒适的方法,因此它将从 python 3.5 目录
调用 pip它是从 github 存储库下载的,在这种情况下我对丢失的 .txt 文件没有任何问题并且非常适合我