[英]Centos 6 - sudo doesn't recognise pip3.4 when installing mysqlclient for Python 3.4
[英]Error when trying to install python module (beautifulsoup) in CentOS 5.11 Server using pip3.4
我寫了一個python3.4腳本來從RSS提要中獲取一些數據,該數據可以按預期工作。 我想創建一個cronjob以使用我的VPS(CentOS 5.11)執行腳本。 服務器已經安裝了常規的python和python3.4,沒有問題(我可以運行python3.4腳本,沒有問題)。 問題是我需要為python3.4安裝的Beautiful Soup才能運行我的腳本,但是當我嘗試安裝它時,我從服務器收到錯誤消息:我使用pip3.4 install beautifulsoup
來安裝模塊。
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/pip/basecommand.py", line 232, in main
status = self.run(options, args)
File "/usr/local/lib/python3.4/site-packages/pip/commands/install.py", line 339, in run
requirement_set.prepare_files(finder)
File "/usr/local/lib/python3.4/site-packages/pip/req/req_set.py", line 333, in prepare_files
upgrade=self.upgrade,
File "/usr/local/lib/python3.4/site-packages/pip/index.py", line 305, in find_requirement
page = self._get_page(main_index_url, req)
File "/usr/local/lib/python3.4/site-packages/pip/index.py", line 783, in _get_page
return HTMLPage.get_page(link, req, session=self.session)
File "/usr/local/lib/python3.4/site-packages/pip/index.py", line 872, in get_page
"Cache-Control": "max-age=600",
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 473, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.4/site-packages/pip/download.py", line 365, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 461, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/cachecontrol/adapter.py", line 43, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/adapters.py", line 370, in send
timeout=timeout
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 518, in urlopen
body=body, headers=headers)
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 322, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 727, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connection.py", line 238, in connect
ssl_version=resolved_ssl_version)
File "/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py", line 254, in ssl_wrap_socket
return context.wrap_socket(sock)
File "/usr/local/lib/python3.4/ssl.py", line 365, in wrap_socket
_context=self)
File "/usr/local/lib/python3.4/ssl.py", line 542, in __init__
raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname
我閱讀了有關虛擬python環境的信息,但我不知道這是否可以按照我想要的方式工作。 我具有對服務器的root訪問權限,我正在通過SSH進行此操作。
任何幫助將不勝感激。
如果我使用pip3.4 --trusted-host pypi.python.org install <package_name>
我可以升級pip3.4並安裝urllib3,但是當我嘗試安裝Beautiful Soup時,我會收到此錯誤:
Collecting beautifulsoup
/usr/local/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
Downloading BeautifulSoup-3.2.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-zgrqhr3v/beautifulsoup/setup.py", line 22
print "Unit tests have failed!"
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-zgrqhr3v/beautifulsoup/
您正在安裝僅支持python 2的beautifulsoup版本3。您需要安裝不支持python 3的beautifulsoup版本4。
做
pip3.4 install beautifulsoup4
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.